forked from MUSA611-CPLN692-spring2020/MUSA611-CPLN692-week4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclassnote.js
More file actions
58 lines (40 loc) · 1.16 KB
/
Copy pathclassnote.js
File metadata and controls
58 lines (40 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
\x => x+2
_+2
var bakedGoodMatches = function(bakedGood){
return _.match(backedGood,{"type":'cake'})
}
_.filter(bakedGoods,bakedGoodMatches)
mydata = [0,10,100,1000]
_.filter(mydata,function(x){
return x>20
})
//but this will lead to those has been filtered also dobled
_.map(mydata,function(x){
return x*2
})
_.chain(maydata)
.filter(function(x){ return x>20})
.map(function(x){return x*2})
//API
promise = $.ajax('https://raw.githubusercontent.com/MUSA611-CPLN692-spring2020/datasets/master/json/philadelphia-bike-crashes-snippet.json?
argument1=123 && argument2 =abc')
promise.done(console.log())
//https://api.jquery.com/jquery.ajax/
plus2 = function(x){return 2+x}
theNumberFive = pluse2(3)
var x = 0
// x changed to 123
sideEffect = function (){
x=123;
cosole.log(x)}
//x still 0
pureF = function (){
var x=123;
console.log(x)}
promise = $.ajax('https://raw.githubusercontent.com/MUSA611-CPLN692-spring2020/datasets/master/json/philadelphia-bike-crashes-snippet.json')
promise.done(function(x){theData=x})
JSON.parse(theData)
parseData = JSON.parse(theData)
parseData.map(function(obj){
return {'lat':obj.lat_final,'lng':obj.long_final}
})