When we want to define a function in JavaScript during the day, we can use more than one method. You probably know how they are.

Although we use these often, we may not know and be curious about their differences, advantages and disadvantages. The main issues I will mention in this article are;

  • Hoisting
  • Anonymous Functions — Named Functions
  • IIFE
  • Garbage Collection

Before touching these issues, let’s look at what is expression and declaration.

Expression:

An expression is any valid set of literals, variables, operators, and expressions that evaluates to a single…

Konuralp Toksoy

Front-End Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store