ES6 Recap
Last updated
Last updated
We've just learned a bunch of ES6.
We've learned:
const
and let
instead of var
Remember, When declaring variables using ES6 syntax, if you need to declare a variable whose value will not change, declare it as a const
. If the variable's value will or might change, unless you need a global scope, you'll likely declare it as a let
.
=>
to declare a function=>
with implicit returns to declare a function that only returns something=>
preserves the original this
contextis now
The second piece of code is synonymous with the first piece of code. The second piece of code saves you from writing price: price
when you're declaring an object key-value pair inside an object.
Remember, these require you to use the tick
``` quotation mark. The single quote or double-quote marks won't invoke string interpolation.