javascript - push to first free place in an Array -
what beautiful way of doing so?
var arr = [1,2,3,undefined, null,,null];
pushing 4
output:
[1,2,3,4,null,,null]
var ind = arr.join().split(',').indexof(''); if (ind !== -1) arr[ind] = 4
what beautiful way of doing so?
var arr = [1,2,3,undefined, null,,null];
pushing 4
output:
[1,2,3,4,null,,null]
var ind = arr.join().split(',').indexof(''); if (ind !== -1) arr[ind] = 4
Comments
Post a Comment