« Back to home

Fun with vim and var

A common style guideline in JavaScript is to use a single var declaration at the top of your functions. This is because even if you use multiple var declarations scattered throughout the code, JavaScript’s scoping rules mean that the variables are actually defined at the top of the function that contains them — so why not make your code reflect reality? So you end up with functions that look like this:…

Read more »