-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArrowfuntionday4.html
37 lines (35 loc) · 1.09 KB
/
Arrowfuntionday4.html
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
<html>
<head>
<body>
<script>
//ES5 Funtion
function add (a=5,b=5)
{
return (a+b);
}
console.log(add());
const normal={
price:"100",
bread: "needed",
myfuntion:function(){
return `${this.price}`//output is 100
}
}
console.log(normal.myfuntion());
// ES6 Arrow Funtion
let added=(a=6,b=6)=>{
return a+b;
}
alert(added());
const normal1={
price:"100",
bread: "needed",
myfuntion1:()=>{ // arrow funtion should not used inside methods and construtor
return `${this.price}`// it will give us undefined this.price
}
}
console.log(normal1.myfuntion1());
</script>
</body>
</head>
</html>