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

99
Visualizações
Why are some JavaScript functions given conjugated names and not others?

As a non-english developer, I often wonder why some javascript functions take a "s" and others don't.

Example:

Array.includes()
Element.contains()

I could figure it's because they are verbs conjugated in the third person. But in that case, why don't the following conjugate?

Array.reduce()
Array.find()
Array.map()

Is there some rule I'm unaware of, or is it just a question of what sounds better for the developer who first writes a library?

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

0

As someone who was an English teacher, I'll firstly say that the main reason this is the case is because English kinda sucks. The grammar is weird, and no matter how many rules you memorize, you'll never speak it absolutely perfectly. Even us native speakers struggle with grammar on a daily basis.

To answer your question thoroughly:

  1. Methods such as includes() and contains() are statements that describe the array/value and return a "yes" or a "no" (a true or false) statement.

English:

My shopping list includes bacon. Is this true?

JavaScript:

const includesBacon = shoppingList.includes('bacon');

console.log(includesBacon); // -> boolean
  1. Methods such as reduce() and map() perform an action on the array/value. You are literally commanding the array to do something to itself.

English:

Please map out a new shopping list based on the old, but all bacon. Now!

JavaScript:

shoppingList.map(() => 'bacon')
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