I have array like this:
let A = [1,2,3,4,5,6,7]
and I want Which parameter is equal === 4
array.includes(4) //true
Top code just show me true but i want show me array[3] is 4
I have array like this:
let A = [1,2,3,4,5,6,7]
and I want Which parameter is equal === 4
array.includes(4) //true
Top code just show me true but i want show me array[3] is 4
You should use .indexOf()
instead of .includes()
let A = [1,2,3,4,5,6,7]
let index = A.indexOf(4)
Output : index = 3