Chapter 1: Three Keys to the Kingdom


Timothy stared at his browser console in complete confusion. He'd written what seemed like simple JavaScript, but the behavior made no sense.



var x = 5;

if (true) {
var x = 10;
}

console.log(x); // 10 - why?!






"That doesn't make sense," he muttered. "I'm used to languages where blocks protect...