I want to get the index of the given value inside a Array using underscore.js.
Here is my case
var array = [{\'id\': 1, \'name\': \'xxx\'},
Underscore uses native indexOf method if available,else applies fallback. Thus, for a list of objects you have to implement it in some other way.
One example could be
_.chain(array).pluck("key").indexOf("value").value();
or
_.map(array,function(e) { return e.key; }).indexOf(value);