-1

What is the difference between this syntax:

beforeEach( async () => {
   ...
});

and this one:

beforeEach(async function() {
   ...
});

Thanks

0

It is two different ways to define a function:

  • The first one is the so-called arrow function, introduced by ECMAScript 6

  • The second one is the classic function in JavaScript.

In most of the cases they are both equivalent, but there are a few features only applicable to the arrow functions (don't have their own this, not hoisted and have to be defined before they are used).

Not the answer you're looking for? Browse other questions tagged or ask your own question.