-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTHIS_and_arrow_function.js
More file actions
64 lines (41 loc) · 1.16 KB
/
THIS_and_arrow_function.js
File metadata and controls
64 lines (41 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
59
60
61
62
63
64
const user = {
username:"mohsin",
price:999,
welcomeMassage:function(){
console.log(`${this.username} Welocome to website`); // this is current cont..
}
}
// user.welcomeMassage // refrance
// user.welcomeMassage();
// user.username = "sam";
// user.welcomeMassage();
// console.log(this);
// function chai(){
// let username = "mohsin";
// console.log(this.username);
// }
// chai();
// const chai = function(){
// let username = "mohsin";
// console.log(this.username);
// }
// chai();
// const chai = () => {
// let username = "mohsin";
// console.log(this.username); // undefined
// console.log(this); // {}
// }
// chai();
// basic arrwo functins
// () => {}
// const AddTwo = (num1,num2) => {
// return num1 + num2;
// }
// const AddTwo = (num1,num2) => num1 + num2 // implicit return
// const AddTwo = (num1,num2) => (num1 + num2) // ()
// console.log(AddTwo(3,5));
// const Object_Return = () => ({KeyName_UserName:"Value_Name mohsin"}) // ({Objects return})
// console.log(Object_Return());
// const myArray= [2,5,6,7,5];
// // myArray.forEach(function () {}) // 1.
// myArray.forEach(()=> {}) // 2.