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

222
Visualizações
Why is an array of hex values being re-ordered on evaluation?

In a reactJS app I have an array of hex values that is being reordered, apparently "on evaluation". When logged right after declaration the expanded values are listed in a different order to the unexpanded values. It's this expanded order that the app uses, but the unexpanded order (the declared order) that I expected.

Compare image to snippet, hopefully this is clear.

Btw, I know I can sort it and I know I can put the array directly in the component. I have already solved the problem by adding a key to the array. But I want to understand why it's happening.

const chartColours = [
  '#003f5c',
  '#f8b3df',
  '#c4d94e',
  '#8588b1',
  '#496387',
  '#2f4b7c',
  '#c2b0d9',
  '#665191',
  '#a05195',
  '#d45087',
  '#f95d6a',
  '#ff7c43',
  '#ffa600',
  '#fff18f',
  '#fcc76b',
  '#309975',
  '#de425b'
];
console.log(chartColours);

console log screengrab

about 4 years ago · Juan Pablo Isaza
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