Multiple choice technology programming languages


var str = "This is an Example"; 
 alert(str.search("example"));      

  1. 11

  2. -1

  3. error

  4. Example

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The search() method performs a case-sensitive match when given a string. Because the search term "example" is lowercase and does not match the uppercase "Example" in the string, it returns -1.