DEV Community

Discussion on: Daily Challenge #52 - Building a Pyramid

Collapse
 
chrisachard profile image
Chris Achard

Fun challenge :) I did it in React, so here's the function:

  const pyramid = count => {
    return Array(count).fill().map((_, n) => {
      return <span key={n}>
        {Array((n + 1)*2 - 1).fill().map(i => {
          return "*"
        })}
      </span>
    })
  }

and here's a demo!