We’ve prepared a fun quiz which you can take to see how much you know about ES6 (aka ES2015), and maybe learn a few new things as well!
The let Statement
ES6 gives us a “let” statement – a new way to declare variables. Can you guess what it does?
The const Statement
ES6 introduces a special “const” declaration. Do you know what it does?
Arrow functions work similarly to regular function, but are shorter to write. Can you guess what is the correct usage?
New String Methods
ES6 gives us a number of new methods for operating with strings. Which one replaces this annoying piece of code?
New Array Methods
Did you know we have new array methods as well? Guess which one of them can help shorten this code?
New Array Methods II
Array.from() is a powerful method which converts array-like objects into real arrays. Why do we use it in the code below?
What results will these function calls return?
Which language is this?
ES6 gives us an alternative way to assign variables. Can you guess what the below code does?
What’s the ES6 way for quick initialization of objects from variables?
The Spread Operator
What is stored into the triangle array?
Rest is a new way for functions to handle an arbitrary number of parameters. Can you guess what the mysterious “a” variable holds?
String interpolation is a much-needed new feature that is finally available in JS. See an example below. Is there anything wrong with it?
New For Loops
ES6 comes with new, build in “for loops”. Which one of them do we have to use to mimic the functionality of this traditional “for”?
In the function below, what do we use Object.assign for?
What’s a Promise()?
Generators and yield
Generators allow us to pause and resume the execution of a function*. What will be printed after running this code?