11_chess_one_line.js 333 B

123456789101112
  1. let strSpace = ' ';
  2. let strHash = '#';
  3. let strResult = '';
  4. let strHashLength = 5;
  5. let strSpaceLength = 6;
  6. for (let i = 1, j = 1; i <= strHashLength || j <= strSpaceLength; i++, j++) {
  7. if(j <= strSpaceLength) strResult += `${strSpace}`;
  8. if(i <= strHashLength) strResult += `${strHash}`;
  9. }
  10. console.log(`"${strResult}"`);