🎁 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...
Watch video indexOf and lastIndexOf methods | String Object In JavaScript online without registration, duration hours minute second in high quality. This video was added by user Code Explained 30 July 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 7,840 once and liked it 215 people.