The length property returns the length of a string (number of characters). https://github.com/mdn/browser-compat-data. your coworkers to find and share information. ECMAScript 2016 (ed. //not on the unicodes of characters which results in correct length of characters return [...stringIterator].length; Syntax. 7) established a maximum length of 2^53 - 1 elements. trim() method. How can I measure correctly with a ruler? var str = "This is a string";var length = str.length;alert( "Length is "+length); Above script will alert "Length is 16". Sign in to enjoy the benefits of an MDN account. Here is really defined, how gets a length of "input field" or "text" value. }); 7) specified 2^53 – 1 length as the maximum length. document.write(my_str.length) The above string will give a out put of 12. Since `length` counts code units instead of characters, if you want to get the number of characters you need something like this: The compatibility table in this page is generated from structured data. It is non-configurable means it’s any of the attributes, writable, configurable or enumerable cannot be changed. } no where in the question does he say anything about the string coming from an, but this still just uses javascript doesn't it? Web development, programming languages, Software testing & others, This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. If you haven’t already created an account, you will be prompted to do so after signing in.