Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function perfectDiamond(input) {
- let n = Number(input);
- for (let i = 0; i <n; i++) {
- console.log(" ".repeat(n - (i + 1)) + '*' + "-*".repeat(i));
- }
- for (let i = n - 2; i >= 0; i--) {
- console.log(" ".repeat(n - (i + 1)) + '*' + "-*".repeat(i));
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement