Top "Ecmascript-6" questions

The 2015 version of the ECMAScript specification, now a standard (ECMAScript 2015).

What's the difference between "super()" and "super(props)" in React when using es6 classes?

When is it important to pass props to super(), and why? class MyComponent extends React.Component { constructor(props) { super(); // or …

reactjs ecmascript-6
When should I use curly braces for ES6 import?

It seems to be obvious, but I found myself a bit confused about when to use curly braces for importing …

javascript import ecmascript-6
How can I clone a JavaScript object except for one key?

I have a flat JS object: {a: 1, b: 2, c: 3, ..., z:26} I want to clone the object except for one element: {…

javascript ecmascript-6 ecmascript-harmony ecmascript-7
How to load external scripts dynamically in Angular?

I have this module which componentize the external library together with additional logic without adding the <script> tag …

javascript angular typescript ecmascript-6
How to use ES6 Fat Arrow to .filter() an array of objects

I'm trying to use ES6 arrow function with .filter to return adults (Jack & Jill). It appears I cannot use …

javascript ecmascript-6 higher-order-functions
How to import a json file in ecmascript 6?

How can I access a json file in Ecmascript 6 ? The following doesn't work: import config from '../config.json' This …

json import ecmascript-6
Why es6 react component works only with "export default"?

This component does work: export class Template extends React.Component { render() { return ( <div> component </div> ); } }; export …

javascript ecmascript-6
Javascript ES6/ES5 find in array and change

I have an array of objects. I want to find by some field, and then to change it: var item = {...} …

javascript arrays ecmascript-6 lodash
Object spread vs. Object.assign

Let’s say I have an options variable and I want to set some default value. What’s is the …

javascript ecmascript-6
How can I alias a default import in JavaScript?

Using ES6 modules, I know I can alias a named import: import { foo as bar } from 'my-module'; And I know …

javascript ecmascript-6 es6-modules