🎁 Join my channel to get access to perks:
/ @codeexplained
🧡 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.";
console.log(str.indexOf("code")); // logs : 4
console.log(str.lastIndexOf("code")); // logs : 30
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.
◾ Facebook : / code.explained.official
◾ Twitter : / code_explained
◾ Instagram : / code.explained.official
◾ GitHub : https://github.com/CodeExplainedRepo
💲 Suppport the Channel
Paypal : https://paypal.me/CodeExplained
Buy Me a Coffee: https://www.buymeacoffee.com/CodeExpl...
Смотрите видео indexOf and lastIndexOf methods | String Object In JavaScript онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Code Explained 30 Июль 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 7,840 раз и оно понравилось 215 людям.