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
  • 16,176
  • 3
  • 29
  • 54
Joshua Shibu
  • 189
  • 1
  • 4

1 Answers1

1

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

const responseName = async (name) => `hello ${name}`;
Maximilian Burszley
  • 16,176
  • 3
  • 29
  • 54