Modern JavaScript syntax – ES6 const variables

Introduction

ES6 brought lots of new features. Among them is support for constants. Instead of using var while declaring variables, you are now free to choose between const and let.

In this tutorial I will focus primarily on const and its “immutability” quirks, while let will be tackled in the following one. Without further ado, let’s start it off by going through the handful of examples.

Continue reading “Modern JavaScript syntax – ES6 const variables”


If you enjoyed this post, then make sure you subscribe to my Newsletter

How to start using modern Javascript syntax within minutes

Introduction

Everyone, including browsers, got used to the JavaScript syntax from 90-ties. But time passes by and JavaScript becomes more and more popular, so ECMA, the committee behind the changes in JavaScript, woke up and started to release new features.

The most recent major update to the specification was approved on 17th of June 2015 and is called by many names: ECMAScript 6, ES6, ES2015, and ES6Harmony.

Based on current plans, new specs will be released on a yearly cycle. Please monitor ECMA’s news page, especially changes related to the ECMA-262 document, if you are really interested.

Shall we as developers be excited? Definitely, cause we love bleeding-edge features, however we should also consider the browsers’ compatibility list.

It turns out that main players as Google Chrome, Mozilla Firefox, Apple Safari, and Windows Edge adopt new JavaScript syntax slowly, each one in different pace and priority, so it’s literally impossible to write modern Javascript syntax as it is. So what is the way then?

As you know JavaScript is an interpreted language: the browser interprets the code as text, so there is no need to compile JavaScript. Since we want to use the latest features, we need a way to convert fancy source code into something that poor browsers can interpret. This process is called transpiling, and it is what Babel is designed to do.

In this tutorial I will show you a few easy ways of tinkering with modern JavaScript syntax, without the need of installing anything nor going into complexity of Nodejs, NPM and Module bundlers.

Continue reading “How to start using modern Javascript syntax within minutes”


If you enjoyed this post, then make sure you subscribe to my Newsletter