cf.completefrontend

Predict the outputMedium

What does this script log when it declares var a twice and let b twice?

What does this log?
var a = 1;
var a = 2;
console.log(a);
 
let b = 1;
let b = 2;
console.log(b);

The answer

Work out every line it logs, in order. Then check.

Checking your sign-in…