loops - Counting and printing a serial number +1 if less than last serial number JavaScript -
so have 2 serial numbers , 199 serials in between them:
899720101000105500 (first)
899720101000105699 (last)
i need print first serial , 199 last serial. thing i've found +1 first serial every time loop runs , printing it.
i've copied/pasted different parts , have:
var lowend = 899720101000105500; var highend = 899720101000105699; var arr = []; while(lowend <= highend){ arr.push(lowend++); }
is there max number length can store in variable?
here's solution specific problem may come across this. make static parts of number (the digits don't change) string , use digits change (for me last 4) count , add string count , log it.
var serialnumber = 5500; while(serialnumber <= 5699) { serialnumber = serialnumber + 1; var fullnumber = "89972010100010" + serialnumber; console.log(fullnumber); }
Comments
Post a Comment