To retrieve the length of a JavaScript string, access the length property of the JavaScript string object, as follows:
var strTest = 'Joey JavaScript';
document.write(strTest.length);
Note that an empty string has a length of 0.
Filed under: JavaScript, programming |
Leave a comment