InterviewSolution
Saved Bookmarks
| 1. |
Predict the output!var arr = newArray (20,5,6,3,9);for (I=0;I |
Answer» Corrected Code:Language: JavaScript. var arr = new Array(20,5,6,3,9); for (i=0;i<5;i++){ if(arr[i]%2==0) document.write(arr[i]); } Output:
Explanation:
The given code PRINTS the even elements of the array. 20 and 6 are the even elements in the array. So, output – 206. |
|