What will be the output? let arr = [1, 2, 3]; let result = arr.map(num => num * 2); console.log(result);
Show more
2 months ago • The Providers
What will be the output? let arr = [1, 2, 3]; let result = arr.map(num => num * 2); console.log(result);
[1, 2, 3]
[2, 4, 6]
[3, 6, 9]
Error
19 answered
3
0
2 months ago • The Providers
What will be the output? let arr = [1, 2, 3]; arr.length = 0; console.log(arr);
[1, 2, 3]
[]
undefined
Error
16 answered
2
0
2 months ago • The Providers
What will be the output?
let arr = [2, 4, 6];
let sum = 0;
for(let num of arr){
sum += num;
}
console.log(sum);6
10
12
14
18 answered
3
0
2 months ago • The Providers
What will be the output? let arr = [1, 2, 3]; let result = arr.includes(2); console.log(result);
true
false
2
undefined
11 answered
1
0
2 months ago • The Providers
What will be the output?
let arr = ["HTML", "CSS", "JS"];
console.log(arr.indexOf("CSS"));0
1
2
-1
16 answered
1
0
2 months ago • The Providers
What will be the output? let arr = [1, 2, 3, 4]; console.log(arr.slice(1, 3));
[1, 2, 3]
[2, 3]
[2, 3, 4]
[1, 2]
9 answered
1
0
2 months ago • The Providers
What will be the output? let arr = [1, 2, 3]; arr.unshift(0); console.log(arr);
[1, 2, 3, 0]
[0,1, 2, 3]
[1, 2, 0, 3]
Error
11 answered
2
0
2 months ago • The Providers
What will be the output? let arr = [10, 20, 30]; arr.shift(); console.log(arr);
[10, 20]
[20, 30]
[30]
[]
5 answered
0
0
2 months ago • The Providers
What will be the output? let arr = [1, 2, 3]; arr.pop(); console.log(arr);
[1, 2]
[2, 3]
[1, 2, 3]
[]
4 answered
0
0
2 months ago • The Providers
What will be the output? let arr = [5, 10, 15]; console.log(arr[arr.length - 1]);
5
10
15
undefined
8 answered
1
0