Use this tag for questions about features finalized in ECMAScript 2017. Do *not* use this tag if the code in question merely *uses* one of the features, *unless* the feature is cause of the problem.
How can a variable declared in if condition is hoisted and not function?
Example 1:
var x = 1;
if(a = 1) {
x += typeof a;
}
x; // 1number
a; // 1
When tried same with function in SpiderMonkey and V8 hoisting didn't happen. Why not? What…
I'm trying out instanceof operator. I tried out something like this.
function f(){ return f; }
new f() instanceof f;
// false
Why this came out to be false, when these are true
function f(){ return f; }
new f() instanceof Function;
//…
I have an object with some propreties:
const carOptions = {
mazda: 25000,
tesla: 85000,
bmw: 100000
}
I would like to convert a for loop …
for (let i = 0; i < cars.length; i++) {
if (cars[i].checked) {
return carOptions[cars[i].id]
…
I have this result from my controller and want to catch some items.
Let´s see some code:
```
[
{
"id": 17,
"corretora_id": 1,
"user_id": 2,
"order": null,
"nome": "Johnny English",
"telefone": "(11)0070-0070",
…
Code
class Parent {
constructor() {}
}
class Child extends Parent {
constructor() {
super();
}
}
Background
As I was trying to understand exactly how super() invocations in class constructors work, I followed the following sequence of…
According to this SO post, a CallExpression always contains a call and thus cannot be part of the expression following the new operator.
However, ECMAScript 2017 states:
MemberExpression:
PrimaryExpression
MemberExpression [Expression]
…
Where in the ECMAScript specification can we find text that describes exactly when a new Lexical Environment is created?
I could not find it in "8.1 Lexical Environments", which just loosely states:
Usually a Lexical Environment is associated…
I have some trouble to import dynamicaly a class.
I use alias for this projet :
config.resolve.alias = {
App: path.resolve('./src/'),
Reactive: path.resolve('./app/')
}
I want to import a list of class :
const classes = {
foo:…
This might be a special case:
I want to read from a queue (AWS SQS), which is done by making a call which waits a few secs for messages, and then resolves - and call again and again in a loop as long as you want to process that queue (it checks a…
I need to have a bunch of functions complete some tasks and in a final function do something with the results.
I was thinking of using async / await?
async function dosomething() {
// do stuff
// await till finished then grab the result…
I am trying to use the async await.
My app starts like this
axios.get(`${ROOT_URL}/ccidxann.php`)
.catch(err => console.error('axios error get', err))
.then(async res => {
const html = res.data
const jobList = await getJobList(html)
…
I see different ways coders writing a module.exports function.
1st:
module.exports = function() {
return (async () => {
})()
}
2nd:
module.exports = async () => {
}
What is the difference in 1st way and 2nd way?
And what is the need of…
I have a method lookupComplete in react component that call action checkIfAssign, I need wait to response and depend on this response trigger in this method another methods. But recieve Promise {} "result". How to wait until resolve this…
This is how my upload function looks like at the moment. I'm using apollo mutation in that to upload a file.
I do not understand how to use try/catch and catch of the promise (which client.mutate() is) correctly.
Also I declared the upload function…