Created
February 28, 2017 05:51
-
-
Save Underdoge/2d495e881c0f34189dd1d2047bfed437 to your computer and use it in GitHub Desktop.
addBorder
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
function returnLine(text){ | |
var line=["*"]; | |
var letters=text.split(""); | |
for(var i=0;i<letters.length;i++){ | |
line.push(letters[i]); | |
} | |
line.push("*"); | |
return line.join(""); | |
} | |
function returnAsterisks(count){ | |
var asterisks=["*","*"]; | |
while(count>0){ | |
asterisks.push("*"); | |
count--; | |
} | |
return asterisks.join(""); | |
} | |
function addBorder(picture) { | |
var fenced=[]; | |
fenced.push(returnAsterisks(picture[0].length)); | |
for(var i=0;i<picture.length;i++){ | |
fenced.push(returnLine(picture[i])); | |
} | |
fenced.push(returnAsterisks(picture[0].length)); | |
return fenced; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment