Category: variables

ES6 in Action: let and const

In this tutorial, I’ll introduce let and const, two new keywords added to JavaScript with the arrival of ES6. They enhance JavaScript by providing a way to define block-scope variables and constants. This article is one of many covering new features of JavaScript introduced with ES6, including Map and WeakMap, Se...

Quick Tip: How JavaScript References Work

This article was originally published on Medium. TL;DR: There are NO pointers in JavaScript and references work differently from what we would normally see in most other popular programming languages. In JavaScript, it’s just NOT possible to have a reference from one variable to another variable. And, only compound v...

A Beginner’s Guide to JavaScript Variables and Datatypes

So you’ve decided to learn JavaScript, the programming language of the web. If it seems like a daunting journey ahead and you don’t know where to start, here’s a little secret: it doesn’t take any special skill to learn how to program, and everyone starts at zero. Take it one step at a time, an...

What is the difference between CSS variables and preprocessor variables?

Variables are one of the major reasons CSS preprocessors exist at all. The ability to set a variable for something like a color, use that variable throughout the CSS you write, and know that it will be consistent, DRY, and easy to change is useful. You can use native CSS variables (“CSS Custom Properties”) ...

Quick Tip: How to Declare Variables in Javascript

When learning JavaScript one of the basics is to understand how to use variables. Variables are containers for values of all possible types, e.g. number, string or array (see data types). Every variable gets a name that can later be used inside your application (e.g. to read its value). In this quick tip you’ll l...

Quick Tip: Master Closures by Reimplementing Them from Scratch

This article was peer reviewed by Tim Severien and Michaela Lehr. Thanks to all of SitePoint’s peer reviewers for making SitePoint content the best it can be! To say there are a lot of articles about closures would be an understatement. Most will explain the definition of a closure, which usually boils down to a ...