Execute the code synchronously
let i = 0;
function func() {
i = 2;
}
setTimeout(func, 100);
// expected output = 2
console.log(i);
Javascript
Console
let i = 0;
function func() {
i = 2;
}
setTimeout(func, 100);
// expected output = 2
console.log(i);
Javascript
Console