Correctly use callback function
let result = 0;
function getValue() {
setTimeout(function() {
console.log(result);
}, 500);
}
getValue(function() {
result = 5;
});
Javascript
Console