6. Reset the counter - using "140" or 140 in the text() method?



<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>


My solution is as below, and there is one difference between hint solution and mine.
I am wondering as the topic title.
Is there any difference between using “140” or 140 in the text() method?

var main = function() {
('.btn').click(function() { var post = (’.status-box’).val();
('<li>').text(post).prependTo('.posts'); (’.status-box’).val(’’);

$('.status-box').keyup(function() {
    var postLength = $(this).val().length;
    var charactersLeft = 140 - postLength;



<do not remove the three backticks above>


jQuery’s .text() function will accept a String, Number or Boolean.

If a Number or Boolean is supplied, it will automatically be converted to a string representation.


Thank you for answering me! May I ask you more question?
Although the final result seems to be same, which one would be a good convention i should adopt?


I don’t think there is any convention for that particular case - it really depends on the code you have and which functions you plan on using.

Many Javascript functions (such as maths operators) are capable of automatically converting strings to integers, but there are also parse functions available which will convert between data types. That’s why it’s also recommended to store values in variables (I’m thinking of your 140 in particular).