is only valid in async function code example
Example 1: await is only valid in async function
async function start() {
....
const result = await helper.myfunction('test', 'test');
}
Example 2: 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();