I have array of objects
var arr = [
{\"id\" : \"1\", \"description\" : \"one\"},
{\"id\" : \"2\", \"description\" : \"two\"},
{\"id\"
Because inArray
uses ===
to compare elements, and different objects are never ===
to one another. (They're also not ==
to one another.)
E.g.:
var a = {"foo": "bar"};
var b = {"foo": "bar"};
console.log(a === b); // "false"
You'll need to create a method on them to compare them for equivalence, and then do the search yourself.