String Length in JavaScript

Level 128 keystrokes

Prints the length of the string "Hello", which is 5.

JavaScript code

// .length is a property (no parentheses) that holds the number of characters
// "Hello" has 5 characters (H, e, l, l, o), so 5 is printed
1console.log("Hello".length);

Output

5
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.

  • .× 2
  • "× 2
  • ;× 1
  • (× 1
  • )× 1

More JavaScript examples at level 1

← JavaScript typing practice