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

141
Visualizações
what is the use of adding triple dot in array in javascript?

What is the use of adding triple dots in an array in javascript?

my code sample is:

let array = [newArray]

and

let array = [...newArray]*
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Adding triple dots on an array is called spread syntax

By using it like this newArray = [...existingArray], we spread the existingArray into newArray so newArray has all the items of existingArray now.

Common use case of this syntax is to add new items into a new array with the existing items from another array

const oldArr = [2,3,4];
const newArr = [1,...oldArr]; //newArr = [1,2,3,4]

//If you put it like this..
const oldArr = [2,3,4];
const newArr = [oldArr]; //newArr = [[2,3,4]]

See this for more info : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax

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