Removing/Adding a specific variable from an object inside javascript array? [migrated]
- by hustlerinc
I have a map array with objects stuffed with variables looking like this:
var map = [
[{ground:0, object:1}, {ground:0, item:2}, {ground:0, object:1, item:2}],
[{ground:0, object:1}, {ground:0, item:2}, {ground:0, object:1, item:2}]
];
Now I would like to be able to delete and add one of the variables like item:2.
1) What would I use to delete specific variables?
2) What would I use to add specific variables?
I just need 2 short lines of code, the rest like detecting if and where to execute I've figured out.
I've tried delete map[i][j].item; with no results.
Help appreciated.