String Split in JavaScript

Level 247 keystrokes

split() divides a string into an array using a specified separator.

JavaScript code

// Create a comma-separated string
1let str = "a,b,c";
// split() divides the string at each comma
// Returns an array ["a", "b", "c"]
2console.log(str.split(","));

Output

[ 'a', 'b', 'c' ]
Practice typing this code

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.

  • "× 4
  • ,× 3
  • ;× 2
  • .× 2
  • (× 2
  • )× 2
  • =× 1

More JavaScript examples at level 2

← JavaScript typing practice