24.
Which of the following string methods can be used to find the position of a substring within a string?
indexOf()
find()
search()
position()
Correct: A
The correct answer is A1: indexOf(). This method returns the position (index) of the first occurrence of a specified substring within a string. The other options are not valid string methods for finding the position of a substring.