var data = [{"name":"placeHolder","section":"right"},{"name":"Overview","section":"left"},{"name":"ByFunction","section":"left"},{"name":"Time","section":"left"},{"name":"allFit","section":"left"},{"name":"allbMatches","section":"left"},{"name":"allOffers","section":"left"},{"name":"allInterests","section":"left"},{"name":"allResponses","section":"left"},{"name":"divChanged","section":"right"}];
// Google Chrome user.
var index = data.findIndex(obj => obj.name=="allInterests");
console.log(index);
// for IE user
var index = -1;
for (var i = 0; i < data.length; ++i) {
if (data[i].name == "allInterests") {
index = i;
break;
}
}
console.log(index);
// Google Chrome user.
var index = data.findIndex(obj => obj.name=="allInterests");
console.log(index);
// for IE user
var index = -1;
for (var i = 0; i < data.length; ++i) {
if (data[i].name == "allInterests") {
index = i;
break;
}
}
console.log(index);