var array = new Array(5);
array[0] = 1;
array[1] = 1;
array[3] = 1;
array[4] = 1;
console.log(array.hasOwnProperty(0)); //true
console.log(array.hasOwnProperty(1)); //true
console.log(array.hasOwnProperty(2)); //false
console.log(array.hasOwnProperty(3)); //true
console.log(array.hasOwnProperty(4)); //true
I want to insert array that have unsetted element.
var array = [1,1]
var arrayToInsert = new Array(3);
arrayToInsert[0] = 1;
arrayToInsert[2] = 1;
array.splice(1, 0, ...arrayToInsert);
console.log(array.hasOwnProperty(0)); //true
console.log(array.hasOwnProperty(1)); //true
console.log(array.hasOwnProperty(2)); //true, I want to make it false.
console.log(array.hasOwnProperty(3)); //true
console.log(array.hasOwnProperty(4)); //true
How keep unsetted element after I splice(insert) array that have unsetted element?



emptyvalue in JavaScript.