Skip to content

Category Archives: Javascript: The Definitive Guide

Where to declare javascript variables

I’ve been reading the new edition of Flanagan’s “Javascript: The Definitive Guide”, straight through, and I thought I’d make some posts about what I’d learned. In javascript, variables are implicitly declared at the beginning of the function where they are used. So, in the following block, global = ‘global’;   function f() { console.log(global); var […]