Javascript examples for Array Operation:Array Nest
Remove null values from nested arrays
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/* w ww. j a v a 2s. co m*/ var arraylist = [0, 1, null, 5]; var i = arraylist.length; var j =0; var newlist = []; while(j < i){ if(arraylist[j] != null){ newlist.push(arraylist[j]); } j++; } console.log(newlist); } </script> </head> <body> </body> </html>