In JavaScript, String Object provides a function lastIndexOf that is most often used to get the last position of specified string pattern passed to the lastIndexOf function.
In JavaScript String Object has a function indexOf that is most often used to get the position of specified string pattern passed in the indexOf function.