Valid JavaScript-Developer-I Dumps shared by ExamDiscuss.com for Helping Passing JavaScript-Developer-I Exam! ExamDiscuss.com now offer the newest JavaScript-Developer-I exam dumps, the ExamDiscuss.com JavaScript-Developer-I exam questions have been updated and answers have been corrected get the newest ExamDiscuss.com JavaScript-Developer-I dumps with Test Engine here:
A Developer wrote the following code to test a sum3 function that takes in an array of numbers and returns the sum of the first three number in the array, The test passes: Let res = sum2([1, 2, 3 ]) ; console.assert(res === 6 ); Res = sum3([ 1, 2, 3, 4]); console.assert(res=== 6); A different developer made changes to the behavior of sum3 to instead sum all of the numbers present in the array. The test passes: Which two results occur when running the test on the updated sum3 function ? Choose 2 answers
Correct Answer: A,B
Recent Comments (The most recent comments are at the top.)
Igris - Sep 12, 2025
Line 01: let res = sum3([1, 2, 3]); Line 02: console.assert(res === 6); Line 03: Line 04: res = sum3([1, 2, 3, 4]); Line 05: console.assert(res === 6); If sum3 now sums all numbers in the array, which two results occur? (Choose 2) A) Line 05 fails B) Line 02 passes C) Line 02 fails D) Line 05 passes
Answer: A and B
Explanation :
sum3([1,2,3]) → 6, so Line 02 assertion (res === 6) passes → B. sum3([1,2,3,4]) → 10, so Line 05 assertion (res === 6) fails → A.
The updated function sums all elements; first case still equals 6, second no longer does. To fix the test, change Line 05 to console.assert(res === 10);
Ron - Dec 23, 2022
why line 4 assert will fail? both assers are pointing to same res (with small "r")
Stevan Zivlak - Feb 04, 2022
Line 05 is actually line 04.
Rajesh - Jun 04, 2021
Can I get explanation for the answer please. What is line 05 here?
Recent Comments (The most recent comments are at the top.)
Line 01: let res = sum3([1, 2, 3]);
Line 02: console.assert(res === 6);
Line 03:
Line 04: res = sum3([1, 2, 3, 4]);
Line 05: console.assert(res === 6);
If sum3 now sums all numbers in the array, which two results occur? (Choose 2)
A) Line 05 fails
B) Line 02 passes
C) Line 02 fails
D) Line 05 passes
Answer: A and B
Explanation :
sum3([1,2,3]) → 6, so Line 02 assertion (res === 6) passes → B.
sum3([1,2,3,4]) → 10, so Line 05 assertion (res === 6) fails → A.
The updated function sums all elements; first case still equals 6, second no longer does.
To fix the test, change Line 05 to console.assert(res === 10);
why line 4 assert will fail?
both assers are pointing to same res (with small "r")
Line 05 is actually line 04.
Can I get explanation for the answer please. What is line 05 here?