JavaScript TypedArray lastIndexOf() MethodThe JavaScript lastIndex()of method returns the last position of a value, or it returns -1 if the value is not found. NOTE: The string is searched from the end to the beginning, but returns the index starting from the beginning, at position 0.The lastIndexof() method is case sensitive. Syntax:Parameters:Value: The first parameter is value that is going to be searched in the array. Start: It refers the position where to start the search. If the value is not given in the argument, the default value is the length of the array. Return value:Representing the index of the element where the value is found for the last time, or -1 if the value cannot be found. Browser Support:
ExampleJavaScript lastIndexOf() Method Test it NowOutput: 4 Example 2JavaScript lastIndexOf() Method Test it NowOutput: -1 Next TopicJavaScript TypedArray Object |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India