Randel Ramirez Randel Ramirez - 3 months ago 7
Javascript Question

In jquery how do I remove an array element either via index["key"] or value

In jQuery/JavaScript, How do I remove an array element?

something like:

array.remove(array["key"]);

// or

array.remove("value")

Answer

Judging by your code, it sounds like you want to delete an object's property, which you would do with delete:

var obj = { key: "value" };

delete obj["key"];

A very useful guide on working with objects in JavaScript can be found on MDN.

Comments