Finding the length


Anybody know on finding the length of console.log statements?


This could refer to a couple of things, but taken literally, we would need to know the length before we logged it. There is no simple way to determine how much text is logged without physically counting the characters on the screen.

A string expression may be queried for its length by polling its length property. You will learn later on about JavaScript objects so we won't go there now.

var my_string = "This is my string of text characters.";

var my_string_length = my_string.length;

console.log(my_string_length);    // 37


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.