Account
Categories

JavaScript String length Property


Definition:

When you use this function in a program, it counts the total number of characters in a string.

It also counts letters, numbers, symbols, dots, and spaces as characters.

Syntax:

stringVariable.length

Explanation:

Whereas,

  • string → A type of data that stores text.
  • Variable → Store a value.
  • Length → size of the string (number of characters).

Example:

let name = "www.edutation.com"; 
console.log(name.length); // 17

Output: