Checking `charactersLeft` - why doesn't this pass?


#1

This worked for me, but I'm curious why the code doesn't match the "lesson instructions."

The instructions state: Write an else if statement that checks whether charactersLeft is equal to 140. If it is, select the 'btn' class and add the class 'disabled' using .addClass()

Thus I wrote:

else if(charactersLeft == 140) {
$('.btn').addClass('disabled');
}

Whereas the soution provided goes against the instructions and suggests this for else if:
}else if (charactersLeft <= 140){$('.btn').removeClass('disabled');

The difference being using <= 140 and .removeClass rather than == 140 and .addClass


Disable button 1 - what's wrong?
#2

@scriptplayer60157 In this case, I think it's just a case of the SCT (Submission Correctness Test; code checker) expecting something different than what you have.
If your code works properly but it's getting rejected, that's generally the case :wink: