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
2
votes
1 answer

understanding async and await in JavaScript

I am trying to understand why promise is not resolved when I am using async and await keywords. Below is the code that I have var a = 'https://jsonplaceholder.typicode.com/posts'; async function fetchData() { const response = await fetch(a); …
sajan
  • 1,355
  • 1
  • 14
  • 19
2
votes
1 answer

ECMAScript : Some questions about Job and Job queue

this Question About ECMAScript Specification(ECMA-262 8th edition) These Days, I'm little confused about Job and Job Queue. Here is Some Questions. 1: In ECMA-262, There is two kinds of Job Queue. one is ScriptJobs the other is PromiseJobs. So,…
2
votes
1 answer

How to get/post with axios?

I want to make a get and later a post request with axios (should be async). Here is the code: async getJSONAsync() { await app.get('https://*****.io/index.php?/api/v2/get_case/5892', { headers: {'Content-Type' :…
LittleJohnny
  • 105
  • 2
  • 13
2
votes
1 answer

Axios get URL parameter string not accepted

Why do I get error: "The "url" argument must be of type string. Received type undefined" when I run this code: P.S. I also tried to pass in variable with this URL, but the result was the same. var axios = require('axios')(); module.exports =…
LittleJohnny
  • 105
  • 2
  • 13
2
votes
1 answer

Return doesn't seem to be awaiting javascript

const fs = require('fs') const util = require('util') const readFile = util.promisify(fs.readFile) const buildMap = async () => { let map = await readFile(process.argv[2], { encoding: 'utf-8' }) console.log(map) // Returns the right result …
2
votes
0 answers

Why is CreateGlobalFunctionBinding ( N, V, D ) algorithm setting value twice?

I cannot understand some steps of this CreateGlobalFunctionBinding ( N, V, D ) EcmaScript algorithm. Could you explain me steps 5, 7 and 9 in this algorithm? I cannot figure out the sense of 9 step because of 7 step. Why is value V setting twice?…
2
votes
1 answer

What is the difference between async await and async_hooks in Node.js

async_hooks were introduced as experimental in Node v8. Because the name is similar to ES2017 async it could appear that they may be in some way related. Are they? If so, in what way (complementary or competing)?
cmcculloh
  • 47,596
  • 40
  • 105
  • 130
2
votes
1 answer

async/await function does not wait for setTimeout to finish

I'm using await within an async function execute functions in a particular order, if you see here - I wanted startAnim to wait until hideMoveUI had finished executing to execute itself. Though my console log returns: startAnim hideMoveUI My…
daniel aagentah
  • 1,672
  • 5
  • 29
  • 56
2
votes
1 answer

Method extraction for optionally async method

I have 2 methods that are almost identical except that one of them is async and returns a promise that resolves promises returned by the callback method and the other one isn't. The 2 functions are really identical, but because the callback is…
Kamil Janowski
  • 1,872
  • 2
  • 21
  • 43
2
votes
1 answer

ECMAScript 2017: Parsing from nonterminal StringLiteral to String values

I am trying to understand the translation of a string literal to a final String value (consisting of code unit values), following ECMAScript 2017. Relevant Excerpts 5.1.2 The Lexical and RegExp Grammars A lexical grammar for ECMAScript is given in…
Magnus
  • 6,791
  • 8
  • 53
  • 84
2
votes
2 answers

ECMAScript 2017: Difference between string literal, StringValue, String value, and SV

The below excerpts refer to ECMAScript 2017. 11.8.4.2 Static Semantics: StringValue StringLiteral:: "DoubleStringCharactersopt" 'SingleStringCharactersopt' 1. Return the String value whose elements are the SV of this…
Magnus
  • 6,791
  • 8
  • 53
  • 84
2
votes
1 answer

ECMAScript 2017: Why does EscapeSequence include NonEscapeCharacter?

The below excerpts refer to ECMAScript 2017. 11.8.4 String Literals, Note 1 A string literal is zero or more Unicode code points enclosed in single or double quotes. Unicode code points may also be represented by an escape sequence. .... Any…
Magnus
  • 6,791
  • 8
  • 53
  • 84
2
votes
3 answers

async function external stack context

Sometimes code would like to know if a particular function (or children) are running or not. For instance, node.js has domains which works for async stuff as well (not sure if this includes async functions). Some simple code to explain what I need…
DDS
  • 4,325
  • 22
  • 33
2
votes
1 answer

How to Abort (Stop) a chain of promises, executed in a loop? - JavaScript

I have a web application, in which I have two buttons: "start download" and "abort download", that are bind to the methods: start() and stop() accordingly. 1. When the user clicks the "start download" button, the application will loop over an array…
Gil Epshtain
  • 8,670
  • 7
  • 63
  • 89
2
votes
1 answer

ECMAScript 2017, I can't understand Realm.[[TemplateMap]]

I'm writing some article that about ECMA-262's realm in korean(actually there is no article about realm). So, I read ECMA-262 about realm record.and i can understand about [[Intrinsics]], [[GlobalObject]] and etc.. But, I can't understand about…