Return to Snippet

Revision: 69346
at June 2, 2015 23:07 by ursdeep


Initial Code
Ref: https://techfiddler.wordpress.com/2015/06/02/delete-operator-dont-impact-the-length-of-array-in-javascript/



var fruits = ["Apple" , "Banana", "Grape", "Litchi", "Mango", "Orange"];

console.log(fruits.length); //prints 6 as there are six elements
console.log(fruits[3]); //prints Litchi
delete fruits[3];
console.log(fruits.length); //still prints 6
console.log(fruits[3]); //prints undefined

Initial URL
https://techfiddler.wordpress.com/2015/06/02/delete-operator-dont-impact-the-length-of-array-in-javascript/

Initial Description
delete Operator don’t impact the length of Array in JavaScript

Initial Title
delete Operator don’t impact the length of Array in JavaScript

Initial Tags
javascript, array, code

Initial Language
JavaScript