filmov
tv
indexOf and lastIndexOf in JavaScript Arrays

Показать описание
In this video I go over the indexOf and lastIndexOf functions in javascript arrays.
The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.
It compares items using strict equality (===), so it will look for data type to be same as well
lastIndexOf method also works same way except it will search the array from back to the front
The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.
It compares items using strict equality (===), so it will look for data type to be same as well
lastIndexOf method also works same way except it will search the array from back to the front