Created
May 17, 2025 16:52
-
-
Save davidystephenson/fc015ba74738140609b1315ac7103926 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
// 8. Arrow Function | |
// Write a function to print a right angle triangle of stars. Use arrow function which takes a number as a parameter that represents the number of lines in the triangle. | |
// * | |
// ** | |
// *** | |
var triangle = (x) => { | |
for (var i = 1; i <= x; i++) { | |
var star = '*' | |
var repeated = star.repeat(i) | |
console.log(repeated) | |
} | |
} | |
triangle(3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment