Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidystephenson/fc015ba74738140609b1315ac7103926 to your computer and use it in GitHub Desktop.
Save davidystephenson/fc015ba74738140609b1315ac7103926 to your computer and use it in GitHub Desktop.
// 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