Anybody using ES6 yet?
-
My favorite features so far are Destructuring, Arrow Functions, and all of the new String operations, especially templates.
-
My favorites (in no specific order):
- block scoped variables
- String features, especially multi-line strings,
startsWith
,endsWith
- computed property names
...
(function parameters and reducing array to its elements)- Promises
I'm currently taking baby steps towards ES6
-
As a non-developer. What the heck is ES6, and why is it made of node.js magic?
-
ECMAScript 2015 (ES6) in Node.js
https://nodejs.org/en/docs/es6/
https://iojs.org/en/es6.html -
function (player) { var strength = player.strength, agility = player.agility, wisdom = player.wisdom; }
I so want this...
player => { var {strength, agility, wisdom} = player; }
-
@yariplus Hahaha, the main thing I am worried about is that it looks like Greek to me! (no offence to Greeks on this board )
Perhaps with time that syntax will become easier to parse, but right now (as with a bunch of other ES6 examples), my brain fuzzes out and I have no mental modal of what the output is supposed to look like.
e.g.
var f = (i) => arguments[0]+i;
wat.
@frissdiegurke I am also excited for the eventual deprecation (or should I say "eventual falling-out-of-favour") of
var
in favour oflet
. Bring it on!There's
.startsWith()
and.endsWith()
in ES6? Funny, we already use those in NodeBB -
I've been using ES6 for few months already in our project because we have an ES6 to ES5 transpiler (Babel). There is an unwritten rule now in the team to only use
let
andconst
. Thevar
thing never happenedAt the beginning I thought arrow functions were super ugly, but now that I got used to them is fine. You can even omit parenthesis, curly brackets and
return
keyword quite frequently. But I think the best part of arrow function is that it implicitly bindsthis
object so there is no need to specifyfunction() { }.bind(this)
anymore.Anyway, my favorite one is template strings. We make custom elements so we usually need a lot of strings with variables. This feature is super handy
If I'm not wrong async/await is actually for ES7, right?
-
@yariplus your syntax is wrong, should be curly braces, not square brackets. Square brackets are for arrays.
@julian been using ES6 in my newest project with webpack and Babel, you get used to it really fast. Also, async and await are not ES6 features.
Anyways, Julian, I think NodeBB should adopt the Airbnb style guide with ESlint. It's an amazing guide.