Created
October 23, 2014 01:27
-
-
Save chikoski/c1664199cf84620212fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var createSpacer = function(n, numberOfRows){ | |
| var spacer = ""; | |
| var i = 0; | |
| var diff = numberOfRows - n; | |
| while(i < diff){ | |
| spacer = spacer + " "; | |
| i = i + 1; | |
| } | |
| return spacer; | |
| }; | |
| var repeatSFC = function(n){ | |
| var outputValue = ""; | |
| var i = 0; | |
| while(i < n){ | |
| outputValue = outputValue + "SFC "; | |
| i = i + 1; | |
| } | |
| return outputValue; | |
| }; | |
| var nSFC = function(n, numberOfRows){ | |
| var outputValue = | |
| createSpacer(n, numberOfRows) + | |
| repeatSFC(n); | |
| console.log(outputValue); | |
| }; | |
| var sfcPyramid = function(numberOfRows){ | |
| var i = 1; | |
| while(i <= numberOfRows){ | |
| nSFC(i, numberOfRows); | |
| i = i + 1; | |
| } | |
| }; | |
| sfcPyramid(5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment