JSFiddle - React, Tailwind, and code Playground

JavaScript

/* A simplified solution using String.prototype.repeat
 */
 
 const steps = (n) => {
  for(let i = 1; i <= n; i++) {
    let step = '#'.repeat(i) + ' '.repeat(n-i);
    console.log(step);
  }
}

steps(5);
/* Output
"#    "
"##   "
"###  "
"#### "
"#####" */