Array Join in JavaScript

Level 258 keystrokes

join() creates a string by concatenating array elements with a specified separator.

JavaScript code

// Create an array with three string elements
1let parts = ["a", "b", "c"];
// join() combines all elements into one string
// The argument "-" is used as the separator between elements
// Result: "a-b-c"
2console.log(parts.join("-"));

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.

  • "× 8
  • ,× 2
  • ;× 2
  • .× 2
  • (× 2
  • )× 2
  • -× 1
  • [× 1
  • ]× 1
  • =× 1

More JavaScript examples at level 2

← JavaScript typing practice