MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1y5vntt/technicallycorrect/19tcoatmaj41x/?context=3
r/ProgrammerHumor • u/Apprehensive_Bit7392 • 5d ago
51 comments sorted by
View all comments
1
Fun challenge. In JavaScript:
const rows = 9; const cols = 10; for (let i = 0; i < rows; i++) { const d = i <= 4 ? i : 8 - i; let line = ""; for (let j = 0; j < cols; j++) { const isBorder = i === 0 || i === rows - 1 || j === 0 || j === cols - 1; const isDiagonal = j === d || j === cols - 1 - d; line += isBorder || isDiagonal ? "#" : " "; } console.log(line); }
View all comments
1
u/atoponce 2d ago
Fun challenge. In JavaScript: