ScanSkill

length

The length method gives the length of the string.

Syntax

string.length

Example

const randomString = 'This is a random string';

console.log(randomString.length); // Prints: 23

The length method returned the length of the randomString, it also counts white spaces.