filmov
tv
JavaScript Interview Questions - Question 13 #javascript #coding #interview #js

Показать описание
@ByteWarpDev Presents
JavaScript Interview Questions
Question - 13:
const arr = [10, 20, 30, 40];
arr[100] = 50;
Options:
a) 4
b) 5
c) 100
d) 101
Answer:
d) 5
Explanation:
1. The array "arr" initially has "4" elements.
2. Setting arr"[100] = 50" creates an array with "96" empty slots between "arr[4]" and "arr[99]".
3. "filter" method skips "undefined" values but includes "defined" values.
4. The final result array includes "[10, 20, 30, 40, 50]".
#javascript #interview #questionsandanswers #coding #javascriptinterviewquestions
JavaScript Interview Questions
Question - 13:
const arr = [10, 20, 30, 40];
arr[100] = 50;
Options:
a) 4
b) 5
c) 100
d) 101
Answer:
d) 5
Explanation:
1. The array "arr" initially has "4" elements.
2. Setting arr"[100] = 50" creates an array with "96" empty slots between "arr[4]" and "arr[99]".
3. "filter" method skips "undefined" values but includes "defined" values.
4. The final result array includes "[10, 20, 30, 40, 50]".
#javascript #interview #questionsandanswers #coding #javascriptinterviewquestions