I understand that == in JavaScript is comparison with type coercion. And I know that the following statements are true:
'' == false;
' ' == false;
'0' == false;
'\n' == false;
However, I can't get a comparison with 'hello' on the left side to be true:
'hello' == true; // no this is false
'hello' == false; // no this is false
'hello' == 1; // no this is false
'hello' == 0; // no this is false
Is there anything 'hello' can be compared to which results in true other than 'hello'?
There is this one:
This will be evaluated as
truebecause the string isn't empty ornull.Since you want a compare: