var arr = [, 16,20,10];
2 answers
In case JS is not yet version 1.6 and does not support filter() :
var arr = [,16,,20,10], tmp = []; for( var i in arr) tmp.push( arr[i]); arr = tmp.slice(); See about “holes” in arrays (in English)
|
- and if arr = [16,20,, 10,]; ?? - Kill Noise
- Do you need to remove all keys that have no value? arr = arr.filter (function () {return true;}); stackoverflow.com/a/281393/815386 - zb '
|