DEV Community

Discussion on: Daily Challenge #52 - Building a Pyramid

Collapse
 
jalawes profile image
Jamal

Javascript, can be run from the command line:

const floors = Number(process.argv[2]);

for (let currentFloor = 1; currentFloor <= floors; currentFloor += 1) {
  console.log(
    '*'.repeat(2 * currentFloor - 1)
      .padStart((floors + currentFloor - 1), ' '),
  );
}