I understand that let prevents duplicate declarations which is nice.  let x; let x; // error!   Variables declared with let can also be used in closures which can be expected  let i = 100; setTimeout(function () { console.log(i) }, i); // '100&...
I'm trying to wrap my head around the new standardized block-level functions in ES6 by reading the raw spec. My superficial understanding was:   Block-level functions declarations are allowed in ES6. They hoist to the top of the block. In stric...
Is it possible to pass options to ES6 imports?  How do you translate this:  var x = require('module')(someoptions);   to  ES6?...
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: true,      init: function(){      },...
I have an arrow function that looks like this (simplified):  const f = arg => { arg.toUpperCase(); };   But when I call it, I get undefined:  console.log(f("testing")); // undefined   Why?  Example:    const f = arg => { arg.toUpperCa...
I have this module which componentize the external library together with additional logic without adding the <script> tag directly into the index.html:  import 'http://external.com/path/file.js' //import '../js/file.js'  @Comp...
In a project I'm collaborating on, we have two choices on which module system we can use:   Importing modules using require, and exporting using module.exports and exports.foo. Importing modules using ES6 import, and exporting using ES6 export...
Why does object destructuring throw an error if there is no var keyword in front of it?  {a, b} = {a: 1, b: 2};   throws SyntaxError: expected expression, got '='  The following three examples work without problems  var {a, b} = {a: 1, b: 2...
I have a relatively straightforward issue of trying to add inline scripting to a React component. What I have so far:  'use strict';  import '../../styles/pages/people.scss';  import React, { Component } from 'react'; import...
I have a loop which calls a method that does stuff asynchronously. This loop can call the method many times. After this loop, I have another loop that needs to be executed only when all the asynchronous stuff is done. So this illustrates what I wan...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.