Do all 3 ways use the same conversion to bool?
function check(variable){
let b1 = Boolean(variable);
let b2 = !!variable;
let b3 = variable ? true : false;
return b1 === b2 && b2 === b3;
}
>Solution :
Do all 3 ways use the same conversion to bool?
Yes. The Boolean function, the logical NOT operator and the conditional operator all convert the value to a boolean value via the internal ToBoolean algorithm:
(of course engines are free to implement it however they want, but it has to behave like the spec dictates)
