-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharrows.js
54 lines (38 loc) · 917 Bytes
/
arrows.js
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
var b = (x) => {
return x * 2
}
//https://www.sitepoint.com/es6-arrow-functions-new-fat-concise-syntax-javascript/
var multiply = (x, y) => {
return x * y
};
//var f = ([a, b] = [1, 2], {x: c} = {x: a + b}) => a + b + c;
//console.log('testing=f()', f())
console.log('testing=b(4)', b(4))
console.log('testing ', multiply(4, 2))
var materials = [
"Hydrogen",
"Helium",
"Lithium",
"Beryllium"
];
var le = materials.filter(mat => mat.length > 7);
console.log('testing=le', le)
function Person() {
// The Person() constructor defines `this` as an instance of itself.
this.age = 10;
//var that = this;
this.growUp= () => this.age++
}
var p = new Person();
p.growUp();
console.log('testing=p.age', p.age)
// var obj={
// age:1,
// foo:function(){
// console.log(this.age++)
//
// }
// }
//
// //obj.foo()
// console.log('testing age', obj.foo())