A Brief Overview of ES6

ECMAScript 6, or ES6, is a newer version of JavaScript. It has several unique capabilities that weren’t possible in previous versions of JavaScript, for example:

  • Variables can be set with the terms let and const
  • The let keyword is used for block scoping so it doesn’t affect global values
  • TheĀ const keyword is used to protect the value of certain variables – you use this keyword for values that shouldn’t be reassigned
  • It allows you to use template strings to tap into the functionality of template languages to format your JavaScript code with variables like so: `${yourVariableHere}`
  • TheĀ spread operator can turn elements of an array into arguments of a function call or into elements of an array literal
  • Allows us to make classes in JavaScript (can create one super class that other classes inherit)
  • Can pass default values in functions for when you don’t explicitly pass anything for them

In order for browsers to understand ES6, you need to transpile the code. Babel, Traceur, and Closure are used for transpiling code, although Babel is known for supporting the most ES6 features.

For larger scale projects, you can use build tools like Webpack with ES6 – this allows us to load our dependencies. Npm creates a package.json file that runs dependencies.

 

WDI Day Forty-Nine: Intro to ES6 & React JS

We have a three day weekend coming up, which will be perfect for me to start working on more Angular tutorials and getting more comfortable with some of the concepts that we haven’t had much time to cover in class.

Today we reviewed some of the differences and problems solved with ES6 when compared to ES5. The class broke up into teams that worked on lesson plans for different ES6 topics. My group focused on getters and setters and template literals. Both seemed pretty interesting.

Later we reviewed React JS. From the brief introduction we received, I can tell already that I really like React’s error messages – they’re not as cryptic as Angular’s errors. Yet again, we only glazed over a few things, so this weekend I hope to delve deeper into it.