ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 122 - Certified JavaScript Developer I discussion

Report
Export

Refer to the code snippet below:

Let array = [1, 2, 3, 4, 4, 5, 4, 4];

For (let i =0; i < array.length; i++)

if (array[i] === 4) {

array.splice(i, 1);

}

}

What is the value of array after the code executes?

A.
[1, 2, 3, 4, 5, 4, 4]
Answers
A.
[1, 2, 3, 4, 5, 4, 4]
B.
[1, 2, 3, 4, 4, 5, 4]
Answers
B.
[1, 2, 3, 4, 4, 5, 4]
C.
[1, 2, 3, 5]
Answers
C.
[1, 2, 3, 5]
D.
[1, 2, 3, 4, 5, 4]
Answers
D.
[1, 2, 3, 4, 5, 4]
Suggested answer: B
asked 23/09/2024
Osman Taskiran
32 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first