Advertisement
Guest User

PIRULETA

a guest
Oct 14th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. function listo(){
  2. mapa =[[0,2,3],[0,2,3],[0,2,3]];
  3.  
  4.  
  5. for (var i=0;i<3;i++){
  6. for (var j=0;j<3;j++){
  7. var newDiv = document.createElement("div");
  8. if (mapa[i][j]==0){
  9. newDiv.classList.add("rojo");
  10. }else{
  11. newDiv.classList.add("verde");
  12. }
  13. document.querySelector(".mapa").appendChild(newDiv);
  14. }
  15. }
  16.  
  17. }
  18.  
  19. window.onload=function(){
  20.  
  21. listo()
  22. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement