Questions tagged [ecmascript-6]

The 2015 version of the ECMAScript specification, now a standard (ECMAScript 2015). Only use this tag where the question specifically relates to new features or technical changes provided in ECMAScript 2015.

ECMAScript 2015 (also known as ECMAScript 6) is the 2015 specification for the language (now superseded by the yearly released versions, managed by TC39). ES2015 adds significant updates to the language and its implementation in major JavaScript engines is almost complete (except legacy browsers, like Internet Explorer).

The tag or its alias should be used when your question covers one of the ES2015/ES6 features.

Related, transpiler specific tags are: ,


Features

  • Arrow functions
  • Classes
  • Enhanced Object Literals
  • Template Strings
  • Destructuring
  • Default + Rest + Spread
  • let + const
  • Iterators + for..of
  • Generators
  • Unicode
  • Modules
  • Module Loaders
  • Map + Set + Weakmap + Weakset
  • Proxies
  • Symbols
  • Subclassable Built-ins
  • Promises
  • Math + Number + String + Array + Object APIs
  • Binary and Octal Literals
  • Reflect API
  • Tail Calls
  • Typed arrays and DataViews

Useful Links

29895 questions
14
votes
3 answers
14
votes
1 answer

Why set a React Component's state outside of the constructor?

So I just downloaded source code from a React framework, and I'm getting this error in Terminal: ERROR in ./src/components/TextEditor.js Module build failed: SyntaxError: Unexpected token (24:8) 22 | 23 | // Set the initial state when…
Matthew
  • 2,158
  • 7
  • 30
  • 52
14
votes
1 answer

JavaScript intercept module import

I have a SPA (in Aurelia / TypeScript but that should not matter) which uses SystemJS. Let's say it runs at http://spa:5000/app. It sometimes loads JavaScript modules like waterservice/external.js on demand from an external URL like…
ZoolWay
  • 5,411
  • 6
  • 42
  • 76
14
votes
6 answers

Cannot define prototype properties within ES6 class definition

I was trying ES6 syntax and find I cannot define prototype property or instance property within class defination, why forbids it? I was using MyClass.prototype.prop=1 before, try ES7 by babel compiler as below, still cannot define prototype…
gloomyson
  • 171
  • 2
  • 5
14
votes
2 answers

How to create a dynamic Link to attribute in React-Router 2.5

(Disclaimer: I am new to React and React-Router, so this may be obvious to someone with more familiarity) I am creating a simple project with React-Router 2.5.2 with ES6 and I have a working solution but it feels like it may not be the "React Router…
Matthew Nichols
  • 4,866
  • 4
  • 41
  • 48
14
votes
2 answers

React.js throttle mousemove event keep throwing event.persist() error

I need to throttle the mousemove event, and I follow the tips below to build the method, but doesn't work: Perform debounce in React.js Here is my code (http://jsbin.com/binesofepo/edit?js,console,output): class Tool extends Component { …
twxia
  • 1,813
  • 1
  • 15
  • 25
14
votes
2 answers

Using ES6 classes OR Object Literals in controllers for an Express + NodeJS app

There are 2 things that I'm very confused about. What is the advantage of using any of ES6 class or Object literals. And where should I use any of them? Some of the examples that I'm trying out are mentioned below. Please let me know when to use…
Dangling Cruze
  • 3,283
  • 3
  • 32
  • 43
14
votes
1 answer

Symbol.iterator is not a function