var a=8; var b; a==b; var arr2 = new Array(b); for(var i=0;i<arr2.length;i++){ arr2[i] = i+1; } console.log(arr2);