Top "Es6-class" questions

This tag is for questions regarding Classes in Ecmascript 6. The tag is only for classes provided in the Ecmascript version.

JSON stringify ES6 class property with getter/setter

I have a JavaScript ES6 class that has a property set with set and accessed with get functions. It is …

javascript ecmascript-6 stringify es6-class
Testing ES6 class with Jest throws 'not a constructor' error

I found a similar problem here, but there doesn't seem to be an answer. I'm trying to test an ES6 …

javascript babeljs jestjs es6-class babel-jest
Returning ES6 Proxy from the ES6 class constructor

I want user to only set specific properties to an object but as the same time that object should be …

javascript proxy es6-class es6-proxy
How to get Map as an object in javascript ES6?

My Class is using es6 to create an map object at node level, using Map()--"set" function.When class …

javascript node.js ecmascript-6 es6-class
how to unmock a single instance method with jest

coming from rspec, i am having trouble understanding mocking with jest. the approach i am trying for, is to automock …

ecmascript-6 mocking jestjs es6-class
Why is "this" undefined in this class method?

I've tried to search over what seems to be the entire internet, but I'm still vexed by a problem with …

javascript node.js this undefined es6-class
How do you check the difference between an ECMAScript 6 class and function?

In ECMAScript 6 the typeof of classes is, according to the specification, 'function'. However also according to the specification you are …

javascript ecmascript-6 es6-class
unexpected token = for class properties in node 8.4

running the following code in node (v8.4) class TodoStore { todos = []; get completedTodosCount() { return this.todos.filter( todo => todo.completed === …

javascript node.js es6-class class-fields
Define 'real' private methods in ES6 Module/Class in a nodejs only environment without any information leak

I know that there is no REAL private method INSIDE ES6 classes. However I was playing around a little bit …

javascript node.js ecmascript-6 es6-class es6-modules
require working but import not working

I have a actions.js file that is exporting actions like this export var toggleTodo = (id) => { return { type: 'TOGGLE_…

es6-module-loader es6-class es6-modules