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

188
Visualizações
While destructuring array in javascript redeclaration error shown?

enter image description here

Same code is run on vs code and i get the values but while checking in browser console. Above error is shown. Please help to solve the query.

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

0

Prior Chrome 92, it was not possible to redeclare the same const in the console in different executions. https://developer.chrome.com/blog/new-in-devtools-92/#const-redeclaration

I think you could just update your chrome and your code will work (I just tried it) ;)

about 4 years ago · Juan Pablo Isaza Relatório

0

NOTE: This is not an answer, just a suggestion.

when running code in the browser, please run it inside a function and then call that function. This will help you avoid scope issues which might be the case in your question.

I am adding an example here

function test(){
    const value = [1, 2, 3, 4];
    const [a, b, c] = value;
    console.log(a, b, c);
}
test()

This is what you should try to follow. Benefits of following this:

  • can be called multiple times without writing the whole code every time
  • can pass arguments in the function to make it dynamic
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