String replaceAll in JavaScript
Level 3104 keystrokes
replaceAll() replaces all occurrences of a substring with a new string.
JavaScript code
// Create a string with repeated word "foo"1const text = "foo bar foo baz foo";// replaceAll() replaces every "foo" with "qux"2const newText = text.replaceAll("foo", "qux");// Prints "qux bar qux baz qux"3console.log(newText);Output
qux bar qux baz qux
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.
"× 6;× 3.× 2(× 2)× 2=× 2,× 1