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

193
Visualizações
How do I fix prefer destructuring eslint error?

I have to "Use array destructuring prefer-destructuring" error on these three lines. I am trying to restructure these three lines. I keep getting es lint error for this I don't know how to fix it.

function cardGenerate(data) {
  const page = document.createElement('div');
  page.className = 'modelPage';
  const num = data.length;
  const i = Math.floor(Math.random() * num);

  const title = document.createElement('h2');
  title.className = 'port-title';
  const span = document.createElement('button');
  span.className = 'closebtn';
  const img = document.createElement('img');
  const para = document.createElement('p');
  const lang = document.createElement('div');
  lang.className = 'frameworks';
  const ul = document.createElement('ul');
  ul.className = 'lang-pop';
  const list1 = document.createElement('li');
  list1.className = 'add-border';
  const list2 = document.createElement('li');
  list2.className = 'add-border';
  const list3 = document.createElement('li');
  list3.className = 'add-border';

  const btnnice = document.createElement('div');
  btnnice.className = 'live-source';
  const btn1 = document.createElement('button');
  btn1.className = 'live';

  const btn2 = document.createElement('button');
  btn2.className = 'source';

  page.appendChild(title);
  page.appendChild(span);
  page.appendChild(img);
  page.appendChild(para);
  page.appendChild(lang);
  lang.appendChild(ul);
  ul.appendChild(list1);
  ul.appendChild(list2);
  ul.appendChild(list3);
  btnnice.appendChild(btn1);
  btnnice.appendChild(btn2);
  page.appendChild(btnnice);

  img.src = data[i].image;
  img.className = 'project-image';
  title.innerText = data[i].title;
  span.innerText = 'x';

  para.innerText = data[i].text;
  para.className = 'para1';
  
  list1.innerText = data[i].languages[0];

  list2.innerText = data[i].languages[2];

  list3.innerText = data[i].languages[3];

  btn1.innerHTML = `${data[i].live}<img id="live-btn" src="./live.png" alt="btn">`;
  btn2.innerHTML = `${data[i].source}<i id="github" class="fab fa-github"></i>`;
  const mainContent = document.querySelector('.main');

  return mainContent.appendChild(page);
}

`list1.innerText = data[i].languages[0];`

list2.innerText = data[i].languages[2];

list3.innerText = data[i].languages[3];

I have to "Use array destructuring prefer-destructuring" error on these three lines. I am trying to restructure these three lines.

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