What is the output of the following code?
var sum = 0;
var x = [1, 3, 7, 11];
?
x.forEach(sumArray);
?
function sumArray(value) {
sum += value;
}
?

A. ?0
B. ?231
C. ?11
D. ?22

Answer: D

Computer Science & Information Technology

You might also like to view...

Which of the following would correctly call the base class (BaseClass) assignment operator from the derived class (DerivedClass) assignment operator?

DerivedClass& DerivedClass::operator =(const DerivedClass& rightSide) { //what goes here? } a. BaseClass::operator=(rightSide); b. leftSide=rightSide; c. rightSide=BaseClass.rightSide; d. DerivedClass::rightSide=BaseClass::rightSide; A

Computer Science & Information Technology

Given a class A that derives from a class B that derives from a class C, when an object of class A goes out of scope, in which order are the destructors called?

a. C, B, then A b. A, B, then C c. unable to determine d. depends on how the code is written for the destructors

Computer Science & Information Technology