Question: Consider the following function: function mystery(arr) { vars1=0 ; vars2=0 ; for(var =arr[k]>082==0s1=s1+s2=s2+k=0;k { } var num =arr[k]; if (( num )) > (

Consider the following function:\ function mystery(arr) {\

vars1=0

;\

vars2=0

;\ for(var

=arr[k]>082==0s1=s1+s2=s2+k=0;k {

}

\ var num =arr[k];\ if (( num

))

>

(

0)&( num 82

)

==

((

0)){

}

\ s1=s1+ num;\

{

}\ else if (num

)

(

0 ) {

}

\ s2=s2+ num;\

{

}\

{

}\ document.write(s1 + " " + s2);\
 Consider the following function:\ function mystery(arr) {\ vars1=0;\ vars2=0;\ for(var =arr[k]>082==0s1=s1+s2=s2+k=0;k

Consider the following function: function mystery(arr) \{ vars1=0; vars2=0; for (var k=0;k0)&&( num &2==0)){ s1=s1+ num; \} else if (num s2=s2+ num; \} \} document.write(s1+" +"+s2); \} Which of the following best describes the value of s1 output by the function mystery? The sum of all positive even values in array arr The sum of all positive values in arr The sum of all positive odd values in arr The sum of all values greater than 2 in arr

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!