Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

await is only valid in async function

async function start() {
   ....

   const result = await helper.myfunction('test', 'test');
}
Comment

SyntaxError: await is only valid in async function

// My function
const myfunction = async function(x, y) {
  return [
    x,
    y,
  ];
}

// Start function
const start = async function(a, b) {
  const result = await myfunction('test', 'test');
  
  console.log(result);
}

// Call start
start();
Comment

PREVIOUS NEXT
Code Example
Javascript :: fizz buzz program in javascript 
Javascript :: read files in node js 
Javascript :: gsap scrolltrigger 
Javascript :: postgres boolean column 
Javascript :: TypeError: navigation.getParams is not a function. 
Javascript :: how to add all values of array together js 
Javascript :: js html input limit to 5 words 
Javascript :: create-react-app npm yarn 
Javascript :: change terminal shortcut vscode 
Javascript :: node js do request 
Javascript :: js changing selected option by index 
Javascript :: axios all methods 
Javascript :: socket..io 
Javascript :: card react native 
Javascript :: javascript convert utc to local time 
Javascript :: get 2nd td of tr 
Javascript :: javascript caeser cipher 
Javascript :: function countdown() 21 sec 
Javascript :: javascript array clear 
Javascript :: sequelize select fields 
Javascript :: text background fabricjs 
Javascript :: define maxmum size of schema field in nodejs 
Javascript :: javascript variable in html string 
Javascript :: range in javascript 
Javascript :: timing code in javascript 
Javascript :: js loop through function arguments 
Javascript :: rethrow error javascript 
Javascript :: javascript array.contains 
Javascript :: define value in js 
Javascript :: this is javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =