Skip to content

Instantly share code, notes, and snippets.

@wmantly
Created November 12, 2014 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmantly/c9061b9d6f48477b2dee to your computer and use it in GitHub Desktop.
Save wmantly/c9061b9d6f48477b2dee to your computer and use it in GitHub Desktop.
var makeTriangleConsole = function( triHeight ){
triHeight = Number( triHeight );
out = "";
console.log(triHeight)
for( var rowI = 0; rowI <= triHeight; rowI++ ){
for( var colI = 0; colI <= 5; colI++ ){
if( colI < ( triHeight - rowI) ){
out += " ";
}else{
out += "x";
}
if( rowI == triHeight && colI == triHeight -1) return out;
}
out += "\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment