Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
¿Cómo puedo agregar una imagen a la función JS?

Estoy tratando de hacer un juego de pac-man y mi código de la función para agregar diseño en el tablero se ve así:

 for (let i = 0; i < layout.length; i++) { const square = document.createElement('div') grid.appendChild(square) squares.push(square) // add layout to the board // if (layout[i] === 0) { squares[i].classList.add('pac-dot') } else if (layout[i] === 1) { squares[i].classList.add('wall') } else if (layout[i] === 3) { squares[i].classList.add('strawberry') } }

Quiero agregar una imagen a los cuadrados en classList Strawberry . Intenté crear un div en html y diseñarlo con css, pero no funcionó. También probé la etiqueta img con una identificación, pero tampoco funcionó.

¿Cómo puedo agregar una imagen a los cuadrados?

¡Gracias por la ayuda!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

En clase fresa poner un estilo css llamado imagen de fondo

 .strawberry { background-image: url(""); /* put image url in the url ("") any url will work ex. images/myimage.jpg or www.web/image.jpg */ }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!