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