JavaScript for Beginners #33 indexOf() Method for Arrays

preview_player
Показать описание
Here, we will learn about the indexOf() method for arrays in JavaScript. The indexOf() method will search an array and return the first index at which a given element can be found. If it isn't present we will get a return value of -1.

0:00 What is the indexOf() Method
0:20 Example #1 using the indexOf() Method
1:58 Searching from a given index
2:25 Getting -1 as a result
2:47 Example #2 using the indexOf() Method

JavaScript Playlist:

MDN Arrays:

MDN indexOf() Method:

NodeJS:

VS Code:
Рекомендации по теме
Комментарии
Автор

I have seen a few indexOf explanation, but usually it is used for finding a letter in a text; your is way better example, thanks!

K
Автор

This is honestly so well explained. Really appreciate that you put this together :)

samoinawangui
Автор

you did not have to do while i++ in the while loop?

K