Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

167
Visualizações
Is there a way to use const using traditional function declaration

I am new to JS and still a newbie. So I am learning new ways of using functions in JS like the arrow fucntions. const func= () => {}

We can use var and const in arrow functions Is there any way to use it the traditional function declaration methods like -

function func() { }

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Among dozens of different ways of declaring a function the following 2 are the most commonly used (and favored by the JS community:

  1. Arrow Function: const Foo = () => {}
  2. Regular Function: function () {}

And that is why you almost always see the above formats throughout the not only the beginning, but also the rest of your programming career! But that does not, necessarily, mean you cannot use some other alternatives i.e. "const/var in traditional way of declaring"

One good example can be a named function expression:

const count = function(array) { // Function expression
  return // something;
}

For a better understanding, I would suggest checking out the following blog post: 6 Ways to Declare JS Functions

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda