No reason to complicate it, you can use a for loop
function getArrForNum(num){
var arr = []; // create a new array
var digitNum = num.toString().length; //get the number of digits, can use Math.log instead
var mulOf10 = Math.pow(10,digitNum-1);
for(var i=1;i*mulOf10 < num;i++){
arr.push(i*mulOf10); // push the next multiple of 1000
}
return arr; //return it
}
Then you can use it:
getArrForNum(3211); //1000,2000,3000
getArrForNum(321); //100,200,300
Here is a one line version just for the challenge, but I strongly suggest avoiding it :)
Array(+(832+"")[0]).join(".").split(".").map(function(_,i){ return (i+1)*Math.pow(10,(832+"").length-1);}); // 800,700,600,500,400,300,200,100
Array(+(3332+"")[0]).join(".").split(".").map(function(_,i){ return (i+1)*Math.pow(10,(3332+"").length-1);}); //1000,2000,3000