Linked Questions

4 votes
3 answers
4k views

How do you create a named async arrow function? [duplicate]

Currently, I have this code: async function getConnection(){ // logic here... } To make it consistent with the rest of my codebase, I want to change it to an arrow function. I've tried async ...
ifvictr's user avatar
  • 143
-2 votes
1 answer
6k views

How to add multiple parameters in arrow function [duplicate]

already sorry for my stupid question but googling for it was not successful How can I add multiple parameters in an arrow functions. I want to add some properties "props" to the following ...
Sam Simon's user avatar
0 votes
1 answer
598 views

What is role the of url in async function in web scrapping [duplicate]

I am working on web scrapping and I came across one scenario where I am get confused about arrow key function,I am unable to understand why url is used twice and how it is actual working, I know it is ...
Anonymous's user avatar
  • 1,094
1 vote
1 answer
395 views

Defining functions with lambda expressions in Js [duplicate]

When defining an asynchronous function I normally go for async function myFunc(){ // ... } I would like to switch over to lambda expressions. I tried async myFunc() => { // throws an syntax ...
Question3r's user avatar
  • 4,072
-5 votes
1 answer
143 views

SyntaxError: Unexpected token ( [duplicate]

SyntaxError: Unexpected token ( The problem is in (bot). This part of the code: let task = async (bot) => {
MrGhostOff's user avatar
844 votes
3 answers
271k views

Are 'Arrow Functions' and 'Functions' equivalent / interchangeable?

Arrow functions in ES2015 provide a more concise syntax. Can I replace all my function declarations / expressions with arrow functions now? What do I have to look out for? Examples: Constructor ...
Felix Kling's user avatar
23 votes
3 answers
100k views

Calling async function on javascript onclick (or any) events

I am trying es6 in js along with async/await. What i have done is : html code <input type="button" onclick="javascript:examplefunction()" /> Js code in seperate example.js file, which is ...
TShrestha's user avatar
  • 1,338
20 votes
3 answers
17k views

Using an await in function parameter

Is it possible to use await with a parameter? for example: const run = async () => { getStudentDetails(await getStudentId()); } Even if it is, it seems like it might not be the best idea. Anyone ...
Justin's user avatar
  • 3,069
4 votes
2 answers
8k views

Using Async/Await in ES6 React .JS

I have a NetCore2 app with ReactJS installed. My React app does something like this -> User inputs into a field axios makes a call to an api to get the user and/or list of users The input field shows ...
Dante R.'s user avatar
  • 932
1 vote
1 answer
3k views

how to fix syntaxeror when start yarn

I'm beginner React developer and have syntax error when I start yarn in atom. I didn't edit any code before I first started yarn, but it has a syntax error. I have successfully run create-react-app ...
hyerim hyun's user avatar
3 votes
2 answers
1k views

Correct typescript async await syntax with typed arrow functions

Similar question for vanilla JS here. I however want to use async await with typescript function as below. Javascript const foo = async () => { // do something } Initial attempt export const ...
Amos Machora's user avatar
0 votes
2 answers
5k views

async arrow function SyntaxError: Unexpected token (

I'm using node version 10.15.3, npm version 6.9.0, VS code, and firebase-functions version 2.2.0 on a windows pc. Adding async/await to my app.post() function causes this: Function failed on loading ...
user11210907's user avatar
2 votes
1 answer
2k views

How to run async function outside ngZone? [duplicate]

I have tried to tun script outside current Zone: async ngAfterViewInit(): Promise<void> { this.ngZone.runOutsideAngular(() => { await this.run(); }); } async run() { ...
user avatar
0 votes
1 answer
1k views

How do I fix ‘Parsing Error: The keyword ‘await’ is reserved’

Above is my code, However, I am getting an Error:- ‘Parsing Error: The keyword ‘await’ is reserved’ The line where my Error is occurring is below. Help me if you can please. I get the error of the ...
ScottE's user avatar
  • 99
0 votes
2 answers
2k views

Async function never stops running

I am running this function with NodeJS, but the process never stops running, despite the fact that I am returning a value once all promises have been resolved. How can I modify this code so the ...
nemesis's user avatar
  • 53

15 30 50 per page