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.