How do I remove an entry, such as [2] from below?
var object = {};
object[0] = true;
object[1] = true;
object[2] = true;
How do I remove an entry, such as [2] from below?
var object = {};
object[0] = true;
object[1] = true;
object[2] = true;
This will work:
delete object["2"]
I would suggest you don't use "object" as your variable name. "object" is a reserved word.
Also, see this question: how-to-remove-a-property-from-a-javascript-object
EDIT:
Actually "object" is not on the list of reserved words. But "Object" (capital "O") does have a meaning in JavaScript. So I would discourage using that name anyway.