String Search in JavaScript
Level 264 keystrokes
search() searches for a match using a regular expression and returns the index.
JavaScript code
// String to search in1const text = "Hello, World!";// search() returns the position of the first regex match (7 here, -1 if none)2console.log(text.search(/World/));Output
7
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this JavaScript code and how often they appear.
;× 2.× 2"× 2(× 2)× 2/× 2,× 1!× 1=× 1