
Lecture No 27 Advance JavaScript Learn indexOf or lastIndexOf Hindi/Urdu #javascript #developer
The indexOf method The method indexOf() in JavaScript allows us to get the first index or position of a specified value inside a string. That value could be a word inside the string or just a letter. If we have two similar values in the string, the method will return the first index of the first value that it finds. The method accepts two arguments: Search value(required): The value that you want to search for and get its first index. The start index(optional): The index position where you want to start the search. The default position is 0 since indexes start from 0. As I said, the method indexOf() returns the first index position of a specified value in a string. But in case you don't pass the argument or the value is not found in the string, the method will return the number -1. Also, keep in mind that the method indexOf() is case-sensitive. So if you didn't pass the value in the same case as the one specified in the string, it will again just return -1. The lastIndexOf method The method lastIndexOf() is similar to indexOf(), but it returns the first index of the last occurrence inside a string. If we have two or more similar values in the string, the method will return the first index of the last value that it finds. The method lastIndexOf() takes the same arguments as the method indexOf() and also returns -1 if you passed the wrong case or if the value was not found in the string. Here is the example: #Reactjs #development #developer #vuejs #angularjs #learn #findindex #find #javascript #javascriptengineer #filter #map #foreach #reducere #every #some #alert #prompterchallenge #prompt #confirm #slice #splice Lecture No 7 : - How To Used Map Function in JavaScript.(React js, Node js, Vue js) | • Lecture No 7 : - How To Used Map Func... Lecture No 8 : - How To Used JavaScript forEach in JavaScript.(React js, Node js, Vue js) | • Lecture No 8 : - How To Used JavaScri... Lecture No 10 : - How To Used filter Function in JavaScript.(React js, Node js, Vue js) | • Lecture No 10 : - How To Used filter ... Lecture No 11 : - How To Used find Function in JavaScript.(React js, Node js, Vue js) | • Lecture No 11 : - How To Used find Fu... Lecture No 12 : - How To Used findIndex Function in JavaScript React js, Node js, Vue js | • Lecture No 12 : - How To Used find... Lecture No 13 How To Used Reducer Function in JavaScript React js, Node js, Vue js | • Lecture No 13 How To Used Reducer F... Lecture No 14 How To Used some & every Function in JavaScript React js, Node js, Vue js | • Lecture No 14 How To Used some & ever... Lecture No 15 How to Swap Two variable in JavaScript without 3rd variable use | • Lecture No 15 How to Swap Two variabl... Lecture No 16 Advance Array Destructuring in JavaScript | / @saqitechnical2526 Lecture No 17 Advance JavaScript Object Destructuring. | • Lecture No 17 Advance JavaScript Obje... Lecture No 18 How to used & Work Fat arrow Function | • Lecture No 18 How to used & Work Fat ...