Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 519 Bytes

File metadata and controls

26 lines (18 loc) · 519 Bytes

Pyramid generator

Instructions

Given a positive integer n implement a function which returns a list representing the generatePyramid shape with n levels. The function should console log a generatePyramid shape with N levels using the # character. Make sure the generatePyramid has spaces on both the left and right hand sides.

challenge | solution

Examples

pyramid(1)
    '#'

pyramid(2)
    ' # '
    '###'

pyramid(3)
    '  #  '
    ' ### '
    '#####'