The Basics Of JavaScript Variable Definitions & Hoisting

I wrote this tutorial as an introduction to an often overlooked subject. I can’t blame you, JavaScript is an accessible language — just pop open your text editor and you’re ready to start coding. But JavaScript has traditionally been a language of many quirks, oddball features and inconsistencies. Perhaps this article will be helpful to those who are completely new to the language.

Here’s a list of my best web development tutorials.

Variable Definitions

Case-Sensitivity
Let’s just get this out of the way first. Variable names are case-sensitive. This means a and A are two different variables, regardless which keyword (var, let or const) that was used to define them:

Image for post
Image for post

Definitions

Variables can be defined using var, let or const keywords.

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Everything defined in global scope will be available anywhere in your program.
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Written by

Issues. Every webdev has them. Published author of CSS Visual Dictionary https://amzn.to/2JMWQP3 few others…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store