Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #await #valid #async #function
ADD COMMENT
Topic
Name
7+7 =