Last active
October 16, 2023 09:31
-
-
Save jonurry/0b22397d957c9cd42c24018e537a8135 to your computer and use it in GitHub Desktop.
2.1 Looping a triangle (Eloquent JavaScript Solutions)
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
for (var triangle = "#"; triangle.length <= 7; triangle += "#") | |
console.log(triangle); |
trying to create one that takes any value and creates a triangle
const loopTriangle = (loopCounter)=>{
let num=' ';
for (let i = 0;i<loopCounter;i++){
num +=" #";
console.log(num);
}
};
if you run the function it will create your desired triangle
//loopTriangle(10)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you so much for your help. That is shockingly simple.