How to use JavaScript String length

Program to use JavaScript String .length

let a = "Hello World in JavaScript";
let b = a.length;
console.log("String length =",b);


String length = 25

Steps Description

  1. Declare two variable a and b
  2. Initialize two variable with value of string a = "Hello World in JavaScript" and b
  3. String .length Calculates the length of a string by counting its characters and output it as a number.
  4. The value of b variable is displayed with the help of console.log inbuilt function