Implicit Return

when using implicit return for arrow functions,should curly brackets still be used?
or it’s by choice?

Implicit return can only be used without curly brackets. As soon as you use curly brackets you must include a return statement in the function body (unless you want to return undefined).

okay thanks.But what i dont understand is why there are curly brackets in this function here. :point_down: :point_down: and it works!

const profileUpdate = (profileData) => {
  const { name, age, nationality, location } = profileData;

}

that’s not implicit return, if you check what value is returned when you call the function you will notice it is undefined because that function doesn’t return anything

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.