Questions tagged [ecmascript-2017]

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.

Proposals finalized in 2017 include:

387 questions
-1
votes
1 answer

replace the use of function declaration when using es6/es7

I prefer do function declaration doSomething() //still works function doSomething() {} over var doSomething = function() = {} doSomething() because with the function declaration, I don't have to worry about the order, it just got hoisted at the…
Casa Lim
  • 355
  • 3
  • 5
  • 15
-1
votes
2 answers

Break While loop in NodeJS when Async function is done

I have the following node js script: const rp = require('request-promise') let result = '' let asyncdone = false async function m() { return await rp.get('http://google.com') } m().then((html) => { result = html asyncdone =…
nas96
  • 1
  • 2
-1
votes
1 answer

JavaScript es2017 Pad Start Object Property

I am using the babel env preset which allows me to use es2017. I have tested the padStart function on this example: 'a'.padStart(2, '0') which yields 0a. Which is correct and means it's working. However, when I use it on an object it does not work.…
Rob
  • 6,758
  • 4
  • 46
  • 51
-1
votes
1 answer

this.* not working with async/await javascript (node 8.6.0)

I couldn't find why I get this error: And here is my code: create: async (data) => { const insertedData = await dbProvider.query('INSERT INTO users SET ?', data); console.log(this); return await…
Alexander Beninski
  • 817
  • 3
  • 11
  • 24
-1
votes
1 answer

Loading files synchronously in Javascript with await operator

Recently, I've read that there is a await operator in Javascript for waiting for a Promise object returned by an async function. My goal is to use just functions that are provided by the standard Javascript without the need of any external…
Fernando
  • 1,477
  • 2
  • 14
  • 33
-2
votes
1 answer

How to use aynsc/await in javascript for returning objects from asynchronous operations

I cannot for the life of me figure out why async/await behaves the way it does. Consider this example. I want a function that does some db initialization, and returns me the database object when it is done. var globalDb = null; const…
Kjensen
  • 12,447
  • 36
  • 109
  • 171
-3
votes
1 answer

Read Async Object Set Using Await

A global object has its key/value (thing) is set in an async function setter(); using await. How to asynchronously read the value of thing in another async function getter();? I'm getting undefined error because the getter(); is running before the…
Steve
  • 4,946
  • 12
  • 45
  • 62
-3
votes
1 answer

ES6/7 await for async function

I read about await stop the execution while the promise don't get resolve. I'm trying to do the following in my React-native app: static async getFromStorage(key) { const value = await AsyncStorage.getItem(key); console.log(value); return…
-4
votes
1 answer

How can I sum object values by array data using ES standard?

I have an array of objects. Each object has a "tag" property with an array list. The values in this list repeat from object to object. I would like to sum up "cost" and "revenue" based on the "tag" arrays. Not sure explanation makes sense but I have…
-4
votes
1 answer

How does Javascript variable works?

Recently started learning Javascript. Given an assignment for my class, to click a button (a number 10 is written on the button), and there has to be "Result = 55". (here all numbers from 0 to 10 are added) To change words by clicking buttons, wrote…
Ellie
  • 23
  • 1
  • 3
-5
votes
2 answers

Whats the difference between V8 and ES8

I am wondering what is the difference between V8 and the ES8?
-7
votes
1 answer

Babel 2018 Setup for Node JS with automatic transpilation

Can Anyone help me to setup Babel so that my latest ES6, ES7 code runs on NodeJS ?
Sumer
  • 2,687
  • 24
  • 24
1 2 3
25
26