SOURCE

console 命令行工具 X clear

                    
>
console
let out1= 'Nothing';

// 1. If a condition is met, excecute a command

// generate a random number. It can be 0, which is falsy; or 1, which is truy.
// the ranGen then is converted to Boolean
const condition= !!Math.floor(Math.random()*2);


//const command= 'Executed';

const command= ()=>{
    out1= 'The Command was Executed<br>';
    return true;
}

const result1= condition && command();

console.assert(condition === result1, 'Inline Condition #1 Logic Error!');

// ---------------------------------------------------------

// 2. If a condition is met, assign a value;

let result2= condition && 'Assigned';

if (result2){
    out1+= 'The Value Was Assigned<br>'
    result2= true;
}

console.assert(condition === result1, 'Inline Condition #1 Logic Error!');

out1= `The condition is ${condition}, therefore: <br>`+ out1;

document.querySelector('#output').innerHTML = out1;
        <div class='container'>
            <p id='output'>
                Output Error
            </p>
        </div>
body{
    background: #FCFCFC;
}