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

154
Visualizações
Do javascript/react have double arrow operator inside array?

I have array like this:

const arr2 = [
    one => {
      'Hello';
    },
    two => {
      'Answer';
    },
    three => {
      'LOREM IPSUM';
    },
  ];

If javascript have arrow operator inside array then how can i push value at one or at two.

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

0

const arr2 = [
    one => {
      'Hello';
    },
    two => {
      'Answer';
    },
    three => {
      'LOREM IPSUM';
    },
  ];

The one above is basically an array of arrow functions.

so if you do arr2[0] it will print

one => {
      'Hello';
    }

If you wanna do normal push and pop, you can do the same as what you do with arrays in JS

But by your question of double arrow operator , im assuming you wanna have to change values at particular index.

You can always do by arr2[1] = someFunc you wanna assign

Update:

this is what i did and this is the console.log for the same:

const arr2 = [
    one => {
      'Hello';
    },
    two => {
      'Answer';
    },
    three => {
      'LOREM IPSUM';
    },
  ];
  
  arr2.push("hey")
  arr2[1] = "what is this even"
  
  console.log(arr2)

/** [one => {
    'Hello';
  }, "what is this even", three => {
    'LOREM IPSUM';
  }, "hey"] **/

Hope it clears :)

Do let me know in case if any concerns

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