var 123456 while console log 10 Math floor 10

1
2
3
4
5
6
var x = 123456;
while (x != 0) {
console.log(x % 10);
x = Math.floor(x / 10);
}