Can someone please explain the output of the following function?
(function() {
try {
throw new Error();
} catch (err) {
console.log(err);
var err = 5;
var boo = 10;
console.log(err);
}
//Guess what the output is here:
console.log(err);
console.log(boo);
})();
It console logs: 5 undefined 10 (in that order). However, I don't understand where the undefined is coming from.