Live data from Hacker News

ES6 Cheatsheet

github.com

1–10 of 89 posts

Re: ES6 Cheatsheet

#3
post #2

[deleted]

I'm still writing ES5 at work, but I've fully embraced ES6 (and bits of ES7) for personal projects. I love it and it's a major improvement to the language IMO.

Re: ES6 Cheatsheet

#4
post #2

[deleted]

Webpack/browserify remove/polyfill most of the ES6 syntax so it is backwards compatible for browsers. Server side you just need to be aware of your engine's support of ES6.

The extra syntax around arguments (defaults and rest) is useful. ES5 does support function overload, but often ends up some hard to read hacks. Libraries commonly have only a few functions, but the functions have flexible signatures. So the first thing you see when trying to read their source is a jumble of argument parsing.

That said, ES6 can end up with some poor performance. For example, template literals are almost 10x slower than just plain string concatenation. But if you are concerned with performance, writing JS may not the be the best choice.

Re: ES6 Cheatsheet

#5
post #2

[deleted]

I'm all in on ES6 when it's practical or allowed. Arrow functions are wonderful, I love destructuring assignment, const and let, and considering that some projects I work on involve a lot of async stuff, I'm close to just giving in and using ES7's async/await functionality.

But most of the time this is in the context of Node.js development, and in every case I use Babel.js to turn the end result into ES5 code.

I'm perfectly comfortable with using ES5, because as a freelancer/contractor I often have to do so. But I really miss the ES6 stuff and the more I use it, the more time it takes me to 'switch' to a mindset where I'm only allowed to use ES5 functionality.

Nonetheless, it strikes me as really odd to actively prefer ES5. Having worked with Ruby and Python (among others), ES5 feels limiting for no good reason. The only rationale I can think of for prefering ES5 is nostalgia.

Could you elaborate why you don't like the 'perl/python' style changes? Because I truly do not understand why one would choose to limit oneself to things like .bind(this) instead of the different forms of arrow functions that make functional-like programming so much easier. And I've found that the best part of JS is that it's decently functional.

Edit: I would agree when it comes to the new 'class' keyword though. I'm not a fan of that.

Re: ES6 Cheatsheet

#7
post #2

[deleted]

I'm fully using es6 for most of projects now. Started about 2 months ago and will make all new projects I have with it. Import/export, destructuring, templates, string interpolation.. it just cuts down on alot of the cruft (imo).

Re: ES6 Cheatsheet

#9
post #2

[deleted]

Not at work, but I use either ES6 or Typescript personally.

"All of the syntactic sugar stuff changes the look and feel of the language too much for my tastes."

I think it brings it into line with how the language is being used in production these days. Modules, generators etc make the language more beautiful, powerful and easier to maintain.

Re: ES6 Cheatsheet

#10
post #2

[deleted]

Writing ES6 at work, turned into ES5 by Babel. I don't want to write "var self = this" ever again. Also, quite a few Node modules are ES6, and we use NPM for managing our frontend JS packages.
Post reply on HN