jskatas.org Continuously Learn JavaScript. Your Way.

Arrow functions: basics

Arrow functions are a more convinient and shorter way to write a function.

Donate to NGO Julenka. Support Ukranians in need. Julenka is an NGO which my brother founded in 2011 to support Ukranian families and kids in need.

Arrow functions

  • are shorter to write, instead of function(){} write () => {}
  • instead {} use an expression, as return value
  • one parameter can be written without parens
  • many params require parens
  • the function body needs parens to return an object