-
Notifications
You must be signed in to change notification settings - Fork 0
/
ES6_3.js
76 lines (66 loc) · 1.48 KB
/
ES6_3.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// function print()
// {
// console.log('Hello ES5 function');
// }
// print();
// const print = (name) =>{
// console.log(`Hello ES6 function ${name}`);
// }
// print('Alamin');
// const addMe = (a,b) =>{
// return a+b;
// };
// console.log(addMe(15,4));
// const addMe = (a,b) => a+b;
// console.log(addMe(12,4));
// const sqr = x => x*x;
// console.log(sqr(5));
// const dob = [1996, 1995, 1991, 1971];
// const currentage5 = dob.map(function(age){
// return 2020-age;
// });
// console.log(currentage5);
// const currentage6 = dob.map(age => 2020-age);
// console.log(currentage6);
// const currentage62 = dob.map((age,index)=>`${index}: ${2020-age}`);
// console.log(currentage62);
// const currentage622 = dob.map(age =>{
// const result = 2020-age;
// return result;
// });
// console.log(currentage622);
// const obj = {
// name: "Alamin",
// print: function()
// {
// setTimeout(() =>{
// console.log(this.name);
// },1000)
// }
// };
// obj.print();
// const lex5 = {
// aFun : function(){
// console.log(this);
// return function(){
// console.log(this);
// }
// }
// }
// lex5.aFun()();
// const lex6 = {
// aFun6 : ()=>{
// console.log(this);
// return ()=>{
// console.log(this);
// }
// }
// }
// lex6.aFun6()();
const lex56 ={
aFun56:function(){
console.log(this);
return ()=> console.log(this);
}
}
lex56.aFun56()();