Use a callback function to log output
let a = 2;
let b = 2;
function multiply() {
b = a * b;
console.log(`The value of b = ${b}`);
}
function getValue(callback) {
setTimeout(function() {
a = 5;
}, 500);
}
multiply();
getValue(multiply);
Javascript
Console