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,...
  • May 4, 2022
  • 0 Comments
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?...
  • May 4, 2022
  • 0 Comments
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...
  • May 3, 2022
  • 0 Comments
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"; } }...
  • May 2, 2022
  • 0 Comments
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...
  • May 2, 2022
  • 0 Comments
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:...
  • May 2, 2022
  • 0 Comments
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 });...
  • May 1, 2022
  • 0 Comments