Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

301
Vistas
Why are there different ways to create a function in JavaScript? (Hoisting?)

I know that there are 3 ways of creating functions

Function Declaration. Function Expression. Arrow Function.

function foo(){
console.log("boo");
{

and

var foo = function(){
console.log("boo");
}

I know that the first one is hoisted so that even if we call it before the function it will work. For the second one because it is an assigned variable hoisting will not work.

My question why is there such a requirement? I just started learning JS and it does not make sense to me yet to set the difference between those two.

Also how about Arrow Function? Why do we need it as well?

Thank you

Edit1: I found my answer for the question of Arrow Functions which seems too advanced for me. I will review it as I go.

When should I use arrow functions in ECMAScript 6?

I am still not clear about the difference between Function Declaration and Function expression.

about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda