Tell me how to change the function:
function isTrueObject(val) { let bool; if (val instanceof Array || val === null) { bool = false; } else if (typeof val === 'object') { bool = true; } else bool = false; return bool; } console.log(isTrueObject({ x: 1 })); console.log(isTrueObject(1)); console.log(isTrueObject(0)); console.log(isTrueObject('jfkjv')); console.log(isTrueObject(false)); what would be this view:
function isTrueObject(val) { return expression; }
Array.isArray. The current check withinstanceofcan beinstanceofin certain cases. - user207618