Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

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)
    '  #  '
    ' ### '
    '#####'