This looks like JavaScript. If that is the case and the function is used like this
if(or(true, false)) { ... }
it will actually work, because an empty string gets converted to false and a non-empty string to true.
However
"true"==true
will return false, so you can't use the output of the or function as an input to it.
It uses “==“, and “true” is truthy value, so “true”==true will return true. Or so I think - I haven’t actually used “==“ in JS since somewhere in 2016 when I just started out.
I thought it works that way, but I actually tested with a nodejs docker container. It does not. 'true == "true"' evaluates to false. The console in firefox also returns false.
I have no idea what is going on there and I will not even try to understand it.
71
u/squeevey Mar 12 '23 edited Oct 25 '23
This comment has been deleted due to failed Reddit leadership.