Note: The length of an empty string is 0.
No parameter required.
It returns the number of characters in the given string.
JS code to show the working of string.length property:
How can I find the length of a number?
var x = 1234567; x.toString().length;
This process will also work for
Float Number and for
Exponential number also.
Answer: Is there a limit on length of the key (string) in JS object?
How browsers handle it, is another matter. Like Chrome 40 (Desktop), Chrome 40 (Android 5.1), Firefox 36, Opera 27, and IE9+ can deal with a property name of up to 227 characters. Safari 8 (OS X Yosemite) can even handle property names of 230 characters.
Answer: You can count the number of char in the string by using string length Property.
Note: The length property is a string property and not a string method.
Do comment if you have any questions and doubts in the tutorial.
Note: The All JS Examples codes are tested on the Safari browser (Version 12.0.2) and Chrome.
OS: macOS 10.14 Mojave
Code: HTML 5 Version
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.