0

I'm trying to define an async function with an arrow function. This code already throws an error, but I still want to know what the main error is.

async responseName = name => ('hello'+ name);  
responseName('joshua').then(response => console.log(response));
Maximilian Burszley
  • 18,243
  • 4
  • 34
  • 63
Joshua Shibu
  • 188
  • 1
  • 6

1 Answers1

1

You have a syntax error. You cannot define an identifier as async:

const responseName = async (name) => `hello ${name}`;
Maximilian Burszley
  • 18,243
  • 4
  • 34
  • 63