I understand that an empty string is falsy in javascript and a not-empty string is truthy in javascript.
However, why is \'false\' truthy in javascript,
\'false\'
In Javascript any string that is not empty is truthy.
So, when evaluating any non-empty string results in true even when the string itself is 'false'.
true
'false'
You can read more about truthy and falsy values.
If you want to check a string for truthness, you can check it's length.
var val = str.length > 0;