-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelloworld.js
More file actions
94 lines (67 loc) · 1.35 KB
/
Copy pathhelloworld.js
File metadata and controls
94 lines (67 loc) · 1.35 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// let a=16;
// let b=17;
// console.log(`My name is Sumit Awsthi and agi is ${b}`)
// let x = {
// name:"Raghav",
// age: 24,
// percentage:14,
// ismarrted:23
// };
// for(const key in x){
// console.log(key,x[key]);
// }
// function product(a,b,c){
// return a*b*c;
// }
// function fun(x,y){
// // console.log(x-y);
// let a =x(2,3,3);
// console.log(a);
// }
// fun(product,4)
// function h(){
// console.log("hello");
// }
// function hello(){
// console.log("hello");
// }
// function mello(){
// console.log("mello");
// }
// setTimeout(hello,2*1000)
// setTimeout(mello,0.2*1000)
// Printing numbers with atime delay-------------------
// for(let i =1;i<=100;i++){
// setTimeout(function(){
// console.log(i);
// },i*100);
// }
// Using Map --------------------------
// function twice(ele){
// return 2*ele;
// }
// function square(ele){
// return ele*ele;
// }
// let arr = [2,4,1,13];
// console.log(arr);
// let brr = arr.map((ele)=>{
// return ele*ele;
// })
// console.log(brr);
// three steps of using diffrent syntaxically map
// 1.
function add10(ele){
return ele+10;
}
let arr= [2,-1,93,10]
let br = arr.map(add10)
console.log(br)
// 2.
br = arr.map(function(ele){
return ele*ele;
})
console.log(br)
// 3.
br = arr.map(ele=>ele-ele)
console.log(br);