var length = 100, array = new Array(length); while(length--){ array[length] = Math.pow(length, 2); //или length * length; } console.log(array);