TZinovieva

Building JS 100/100

Oct 27th, 2022 (edited)
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function building(input) {
  2.     let floor = Number(input[0]);
  3.     let rooms = Number(input[1]);
  4.  
  5.     for (let i = floor; i > 0; i--) {
  6.         let buff = "";
  7.         for (let j = 0; j < rooms; j++) {
  8.             if (i === floor) {
  9.             buff += `L${i}${j} `;
  10.             } else if (i % 2 === 0) {
  11.                 buff += `O${i}${j} `;
  12.             } else {
  13.                 buff += `A${i}${j} `;
  14.             }
  15.         }
  16.         console.log(`${buff}`);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment