var array = [{"one":1, "two":2},{"one":3, "two":4}];
var result = array.findIndex(function (value) {
if (value === 2) {
return false;
}
return true;
});
console.log(result);
i keep getting '0' in the console. how should i change (value ===2) ? i have tried change to (value === {"two":2}) but still return '0'.
is there any other array method that suitable ?
return truein every case. Also what doesvalue === 2means. value will be an objectvaluein the array.2it will be either{"one":1, "two":2}or{"one":3, "two":4}