Short circuit



examples/js/short_circuit.js
"use strict";

var salary = 8000;
var money = 100000;

function check_standard_of_living() {
    if (money > 1000000 || salary++ > 10000) {
        console.log('I can live well.');
    }
    console.log('I have ' + money + ' in the bank and I get ' + salary + ' as salary.')
}

check_standard_of_living();
check_standard_of_living();
check_standard_of_living();

money = 2000000;
check_standard_of_living();
check_standard_of_living();
check_standard_of_living();

I have 100000 in the bank and I get 8001 as salary.
I have 100000 in the bank and I get 8002 as salary.
I have 100000 in the bank and I get 8003 as salary.
I can live well.
I have 2000000 in the bank and I get 8003 as salary.
I can live well.
I have 2000000 in the bank and I get 8003 as salary.
I can live well.
I have 2000000 in the bank and I get 8003 as salary.

Better not to use ++, -- auto-increment and auto-decrement inside other expressions.