Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+16 votes
asked in CSC211_Winter2018 by (8 points)

1 Answer

+8 votes

str1.toLowerCase() returns the lower case version of "Frodo Baggins" which is "frodo baggins". The indexOf("B") method is on the string "frodo baggins". Since "frodo baggins" has no capital B, then indexOf method returns -1.

answered by (7.9k points)
...