indexOf and lastIndexOf methods | String Object In JavaScript

preview_player
Показать описание
🎁 Join my channel to get access to perks:

🧡 Hello All JavaScript Lovers Outhere!

Today you're going to learn about the String Object In JavaScript.

This tutorial is a series of videos, in each video we will discuss a method (or more) of the String Object in JavaScript.

In today's video, you're going to learn about two string methods, indexOf and lastIndexOf, and know the difference between them.

indexOf is used to get the index of the first occurrence of a searched string in a given string, and lastIndexOf is used to get the index of the last occurrence of the searched string.

Example :
const str = "The code is not working, the code is buggy.";

Both indexOf and lastIndexOf take in a second parameter called position, and it's simply the index you want to start the search for your "search string".

🌍 Social Media Links.

💲 Suppport the Channel
Рекомендации по теме
Комментарии
Автор

Bro! your effort in making this video and visualizations is A++.Thank you so much!

bencielcabutin
Автор

thank you very much, please continue making such videos

M.Maria.
Автор

Thankyou so much. You have explained it very well

codingtime
Автор

Thank you very much. Your explanations is so precisful and understandable.

cebbqck
Автор

thank you so much for making this series, very helpful

reitei
Автор

Thanks, IT is very helpful and superb explanation

kumuthusandeepa
Автор

Love the way you Teach. Love from Bangladesh 🇧🇩

romelmahmud
Автор

THANK U GREAT MAN, You have GREAT GREAT TUTORIALS. MY WISH is that u could pick a practical e.g CRUD IN JS and explain the logic. or explain the common JS logic. Thanks again

abahiduh
Автор

Sounds to me like empty string is philosophically like the human soul.  
From StackOverflow…
The empty string is everywhere, and nowhere. It is within all strings at all times, permeating the essence of their being, yet as you seek it you shall never catch a glimpse.  

Indeed, the empty string can be found between any two adjacent characters in a string as well as at the start and end. The first such instance is the very start of the string, namely position 0. All characters are separated by an empty String.

A string contains the empty string in order to be in accordance with Set Theory, according to which:
The empty set is a subset of every set including itself.
This also means that even the empty string contains the empty string.

stephen