I want to convert an integer, say 12345 , to an array like [1,2,3,4,5] . I tried the code below, but is there a better way to do this?
var n = 12345; var arr = n.toString().split('') ; for(i=0;i<arr.length;i++) arr[i] = +arr[i]|0 ;
javascript
Psych half
source share