Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js delete without changing index

var users = {};

users[1] = 'user 1';
users[2] = 'user 2';

delete users[1];
alert(users[2]);        // alerts "user 2"
alert(typeof users[1]); // alerts "undefined"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #delete #changing #index
ADD COMMENT
Topic
Name
2+3 =