Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function exercise(input) {
- let n = Number(input.shift());
- let result = "";
- for (var row = 1; row <= n; row++){
- for (var k = 1; k <= n - row + 1; k++){
- result += " ";
- }
- for(var col = 1; col <= row; col++){
- result += " " + "*";
- }
- result += "\n";
- }
- console.log(result);
- }
- exercise(["5"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement