Which choice demonstrates the correct syntax for an array in JavaScript?

You want to display a series of elements. Which choice demonstrates the correct syntax for an
array in JavaScript?

You want to display a series of elements. Which choice demonstrates the correct syntax for an
array in JavaScript?

A.
var myArray = Array(1,2,3,4,5)
for (var i = 0; i < myArray.[i]; i++ ){
document.write( myArray[i] + “
” );

B.
var myArray = new Array(1,2,3,4,5)
for (var i = 0; i < myArray.length ; i++ ){
document.write( myArray[i] + “
” );

C.
var myArray = new Array(1,2,3,4,5)
for (var i = 1; i < myArray.length; i– ){
document.write( myArray.length + “
” );

D.
var myArray = Array(1,2,3,4,5)
for (var i = 1; i < myArray.[i] ; i– ){
document.write( myArray[i] + “
” );

Explanation:



Leave a Reply 0

Your email address will not be published. Required fields are marked *