Web
Opt
tools
Configuration
Input String
Search String
Method
indexOf()
lastIndexOf()
Run Visualization
1
Console Output
>
Visual Output
Original String:
Hello World!
Method Used:
indexOf()
Search String:
o
Result:
4
Original Length:
12
Search Length:
1
Method Comparison
indexOf():
Returns the first index at which a specified value occurs in a string (or array), or -1 if not found.
lastIndexOf():
Returns the last index at which a specified value occurs in a string (or array), or -1 if not found.