I want to check if variable is false, true or null. If null or undefined assign array to the variable by default. In other languages this syntax would be just fine to use. In js however when value is false then it assign array to myBool
const boolFromBody = false;
const myBool = boolFromBody || [true, false];
console.log(myBool)
I managed to do it with this syntax where I only check for null value
const boolFromBody = null;
let otherBool = boolFromBody;
if (boolFromBody === null) {
otherBool = [true, false]
}
console.log(otherBool);
Is there any better way to do it in js?