String indexOf Method– We can use native JavaScript indexOf to get the position of first occurrence of specified value. Here in this tutorial, we are going to explain how you can use this method to find the position of string/character in vuejs.
String indexOf Method In Vue.JS Example
You can get the position of a specified value in a string simply as below-
- indexOf– This method returns the position of first occurrence of specified value.
- It return -1 if the value is not found in string.
If you run the above example it will produce the output something like this-