Javascript examples for Array Operation:Array Element
check if value is array
<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 2 s .com*/ //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>