|| as simple control-flow statements.
A statement like
true && “troof” will ultimately return
troof because it’s not falsey. We can use this to our advantage to make a tiny equivalent of an
if conditional statement.
let isIt = "nope", itIs = ['it', 'is']; Array.isArray(isIt) && isIt.push('yep'); Array.isArray(itIs) && itIs.push('indeed'); console.log('Is this an array?', isIt); console.log('Is this an array?', itIs);