Questions tagged [ecmascript-2016]

Questions about new features specified in the ECMAScript 2016 specification.

This tag targets ECMAScript 2016, a JavaScript standard previously known as ECMAScript 7. Any proposal that reached stage 4 by Jan 28th, 2016 became part of the new version.

These are:

484 questions
8
votes
3 answers

Function firing when it wants to. How should I fix this?

I have this video, playing in zindex: -1 with a button and a text input floating over it. The issue is when the text changes, it's supposed to manipulate that state object, not fire the touchable highlight's on click function. When I use the…
8
votes
1 answer

What is after Internet Explorer 11 on Windows 7? How well will ES2016 be supported in enterprises?

I am supporting a web based application in an enterprise. I currently require Chrome, which the enterprise supports through using the Chrome Legacy Browser Support plugin to force an automatic switch. Now that they have updated their Windows 7…
Nathan
  • 1,824
  • 1
  • 21
  • 34
8
votes
2 answers

Override/extend static properties on ES7 classes in React.js

ES7 introduces the concept of static property and method definitions. Along with an ES7-capable transpiler, these can be used in React to specify validators and defaults for props, like so: export default class ComponentOne extends React.Component…
ericsoco
  • 24,913
  • 29
  • 97
  • 127
8
votes
3 answers

Optional dependencies in webpack

for example if I want to add require("index.less") to all files and ignore this line if the file does not exists. how do I do it (including using of loaders for example).
Vitali Zaidman
  • 899
  • 1
  • 9
  • 24
7
votes
1 answer

Babel 7 spread syntax in IE/Edge not working

So i have babel 7 installed, along with the plugin "@babel/plugin-proposal-object-rest-spread" included within my preset-env, however I'm still getting the following error as it hasn't transpiled my spread operators back into es2015. SCRIPT1028:…
7
votes
1 answer

Does Angular 5 polyfill async / await for IE11

We develop a software which needs to be supported by IE11. As multiple sources state, IE11 does not support async/await: https://caniuse.com/#feat=async-functions http://kangax.github.io/compat-table/es2016plus/ as well as several…
tommueller
  • 2,358
  • 2
  • 32
  • 44
7
votes
0 answers

JS: Why `message` property of `Error` is non-enumerable?

According to ES2017 spec the message property of Error is non-enumerable. I'm wondering why so? With non-enumerable property message it's impossible for example to spread the Error object like const payload = new Error('oops!'); // Few lines…
7
votes
3 answers

ES7 async/await conceptual issue

I am migrating an existing program to use async/await (via Babel's bluebirdCoroutines) in order to learn this style. I have been looking at this tutorial. I am a bit troubled by the following behavior. This snippet works as expected: let parts =…
rollingBalls
  • 1,808
  • 1
  • 14
  • 25
6
votes
1 answer

How to make VS Code recognize the ES7 bind operator

VS Code does not recognize the ES7 bind syntax out of the box. Instead, it shows up as a syntax error: Example of highlighted error in code [ts] Declaration or statement expected. I've searched around to see if there's an extension that can help…
6
votes
3 answers

Best way to handle multiple assignment of the same property in javascript

This is the situation: user.username = body.username; user.name = body.name; user.surname = body.surname; user.email = body.email; user.password = body.password; user.privilege = body.privilege; user.pin = body.pin; user.rfidTag = body.rfidTag; I…
6
votes
1 answer

ES6 and ES7 features without babel transpiling in react-native?

I would love to use Javascript ES6 and ES7 syntax (especially async/await, my new best friends) without transpiling. Is that even an option? And should it be an option? It all depends on the sub-question: what Javascript engine does react-native…
Merc
  • 16,277
  • 18
  • 79
  • 122
6
votes
8 answers

Javascript-searching for a string in the properties of an array of objects

I have an array of JSON objects. Given a search string, I want to filter the array for only those objects which have that string as a substring of one of their properties. How do I do this efficiently?
Boris K
  • 3,442
  • 9
  • 48
  • 87
6
votes
4 answers

Math.pow alternative "**" ES7 polyfill for IE11

I'm trying to evaluate an expression which contains power, in string as **. i.e. eval("(22**3)/12*6+3/2").The problem is Internet Explorer 11 does not recognizes this and throws syntax error. Which poly-fill I should use to overcome this? Right now…
6
votes
2 answers

What is the relation between ES6, ES7 (and bigger), ES2015, stage-0, stage-1 (and bigger)?

I am lately confused between the following terms in articles about "new-ish" JavaScript: ES6 ES7 (and sometimes, though rarely, ES8 and bigger) ES2015 (and sometimes ES2016 and bigger) stage-0 (and stage-1 and bigger) It seems some of those are…
Karel Bílek
  • 36,467
  • 31
  • 94
  • 149
6
votes
3 answers

How to match only those numbers which have an even number of `%`s preceding them?

I want to catch numbers appearing anywhere in a string, and replace them with "(.+)". But I want to catch only those numbers which have an even number of %s preceding them. No worries if any surrounding chars get caught up: we can use capture groups…
AneesAhmed777
  • 2,475
  • 2
  • 13
  • 18