String length property in JavaScript

You can get the string length in javascript by length property.


<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>String length property in JavaScript</title>
    var str = "JavaScript";
    var strLength = str.length;
    document.write("Length is: ", strLength);


Length is: 10

Leave a Reply

Your email address will not be published. Required fields are marked *