nas5w/typeofnan-javascript-quizzes

string-methods answer is incorrect

senocular opened this issue · 2 comments

Describe the bug

Answer specified in string-methods is incorrect. The correct answer is marked as "search" but should be "indexOf". search finds the index of a regular expression, not a string (if a string is given, it will be converted to a regex). When finding a string you would use indexOf.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://quiz.typeofnan.dev/string-methods/
  2. Click on indexOf
  3. Click on Submit

Expected behavior
Answer is correct.

nas5w commented

Whoops, I merged a fix before you could do yours. I actually removed search altogether because it coincidentally does work in this scenario. Maybe it's worth a separate question emphasizing the difference between the two?

@nas5w That works too :)