What are the actual uses of the WeakMap data structure introduced in ECMAScript 6? Since a key of a weak map creates a strong reference to its corresponding value,...
I just discovered this feature: Map: Map objects are simple key/value maps. That confused me. Regular JavaScript objects are dictionaries, so how is a Map different from a dictionary?...
I know that the >= operator means more than or equal to, but I’ve seen => in some source code. What’s the meaning of that operator? Here’s the code:...
I don’t understand what is wrong. Node v5.6.0 NPM v3.10.6 The code: function (exports, require, module, __filename, __dirname) { import express from 'express' }; The error: SyntaxError: Unexpected token...
I have a flat JS object: {a: 1, b: 2, c: 3, ..., z:26} I want to clone the object except for one element: {a: 1, c: 3, ...,...
Is it possible to create private properties in ES6 classes? Here’s an example. How can I prevent access to instance.property? class Something { constructor(){ this.property = "test"; } }...
Let’s say I have an options variable and I want to set some default value. What’s is the benefit / drawback of these two alternatives? Using object spread options...
Currently in ES5 many of us are using the following pattern in frameworks to create classes and class variables, which is comfy: // ES 5 FrameWork.Class({ variable: 'string', variable2:...
I’m trying to organize my state by using nested property like this: this.state = { someProperty: { flag:true } } But updating state like this, this.setState({ someProperty.flag: false });...
I am new to ReactJS and JSX and I am having a little problem with the code below. I am trying to add multiple classes to the className attribute...