Javascript examples for Array Operation:Array Element
loop over the array and print out the values
<html lang="en"> <head> <title>Printing Array Values</title> </head> <body translate="no"> <script> var arr = [1, 2, 3, [4, 5], 6, [7, 8, 9]], x, j; for (x in arr) {/* w w w . j a v a 2s . c o m*/ //check if value is array if(arr[x].constructor === Array) { for (j in arr[x]) { console.log(arr[x][j]) } } else { console.log(arr[x]) } } </script> </body> </html>