Skip to content

Commit df26e06

Browse files
committed
config arrow function
1 parent 3e68c99 commit df26e06

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

js_basics/arrow_fun.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// lets understand this keyword
2+
//In JavaScript, the this keyword refers to the object that is currently executing the function. It is a reference to the context in which the function is called. The value of this depends on how a function is invoked:
3+
4+
5+
// const user = {
6+
// name:"krish",
7+
// age:24,
8+
// welcomemsg: function(){
9+
// console.log(` hello ${this.name}`);
10+
// console.log(this);
11+
// }
12+
// }
13+
14+
// user.welcomemsg();
15+
// user.name = "Abhi";
16+
// user.welcomemsg();
17+
18+
// this keyword can;t bs used in function
19+
20+
21+
22+
// lets understand arrow function
23+
// const addtwonumber = (num1,num2) => {
24+
// return num1+num2;
25+
// }
26+
27+
// console.log(addtwonumber(4,9));
28+
29+
const addtwonumber = (num1,num2) => (num1+num2)
30+
console.log(addtwonumber(4,9));
31+
const addtwonumber1 = (num1,num2) => ({username:"krish"})
32+
console.log(addtwonumber1(4,9));
33+
34+
35+

0 commit comments

Comments
 (0)