+ 1

How to get index number of object array using indexOf method only in JavaScript?

10th Jun 2020, 3:59 PM
Dhruti
Dhruti - avatar
4 Respuestas
+ 3
for(i of arr){ console.log(arr.indexOf(i)); }
10th Jun 2020, 4:32 PM
Abhay
Abhay - avatar
+ 2
Thanks Abhay and thanks to infinite too
10th Jun 2020, 4:59 PM
Dhruti
Dhruti - avatar
+ 1
I did this way but I want to do it for this array given below: var arr = [ {id : 1, value : 'a'}, {id : 2, value : 'b'} ] ;
10th Jun 2020, 4:20 PM
Dhruti
Dhruti - avatar