String Function - length()
function or method to find the length or size of the string in javascript?
Explanation
Object:
StringMethod or Function:
lengthDescription: This will count the total number of characters (length or size) present in the string and returns the value.
Example:
<script language=javascript>
var ss = "a character count - size test ";
var result = ss.length;
document.write(result);
</script>
Result:
Explanation:
In the above example,
- the string is stored in a variable ss.
- then the function is called as "ss.length".
- the method counts the total characters in the string and returns it.
- the result is of variable type, integer.