---
title: "Discussion on \"AdventJS 2023: Day 7 Challenge\" | Hashnode"
description: "Discussion on \"AdventJS 2023: Day 7 Challenge\". Drawing a 3D Gift!"
url: "https://hashnode.com/posts/adventjs-2023-day-7-challenge/6573f24a037759c716a0a248"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [AdventJS 2023: Day 7 Challenge](https://alexvalle.dev/adventjs-2023-day-7-challenge?utm_source=hashnode&utm_medium=feed)

Drawing a 3D Gift!

Dec 7, 2023 · 4 min read · alexvalle.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#challenge](https://hashnode.com/tag/challenge)
-   [#nodejs](https://hashnode.com/tag/nodejs)

## Written by

[Alex Valle](https://hashnode.com/@Fenriuz)

@Fenriuz

  
[View profile](https://hashnode.com/@Fenriuz)

Software Developer

I am a Software Developer who loves coding, cats and sharing content!

## Responses

Markdown supported · ⌘↵ to post

[Sergio Corredor](https://hashnode.com/@NeoAres)

[Dec 29, 2023](https://hashnode.com/posts/adventjs-2023-day-7-challenge/6573f24a037759c716a0a248/comment/658ecf6bf073040c2d2a485c)

function drawGift(size, symbol) { let gift = ""; if (size === 1) return "#\\n" if (size === 2) return " ##\\n###\\n##\\n" const NEW\_LINE = "\\n" const HASH = "#"

//top gift += (" ".repeat(size - 1) + HASH.repeat(size) + NEW\_LINE);

//medium top for (let i = 0; i < size - 2; i++) { let spaces = " ".repeat(size - 2 - i); let symbols1 = symbol.repeat(size - 2); let symbols2 = symbol.repeat(i);

gift += spaces + HASH + symbols1 + HASH + symbols2 + HASH + NEW\_LINE; }

//medium gift += (HASH.repeat(size) + symbol.repeat(size - 2) + HASH + NEW\_LINE);

//medium down for (let i = 0; i < size - 2; i++) { let symbols1 = symbol.repeat(size - 2); let symbols2 = symbol.repeat(size - i - 3);

gift += HASH + symbols1 + HASH + symbols2 + HASH + NEW\_LINE; }

//down gift += (HASH.repeat(size) + NEW\_LINE); return gift; }

[Sergio Corredor](https://hashnode.com/@NeoAres)

[Dec 29, 2023](https://hashnode.com/posts/adventjs-2023-day-7-challenge/6573f24a037759c716a0a248/comment/658ec8bf1692adb30db737a0)

function drawGift(size, symbol) { let gift = ""; if (size === 1) return "#\\n"; if (size === 2) return " ##\\n###\\n##\\n";

//top gift += (" ".repeat(size - 1) + "#".repeat(size) + "\\n");

//medium top let mediumTop = ""; for (let i = 0; i < size - 2; i++) { let spaces = " ".repeat(size - 2 - i); let hash = "#"; let symbols1 = symbol.repeat(size - 2); let symbols2 = symbol.repeat(i); let newLine = "\\n";

mediumTop += spaces + hash + symbols1 + hash + symbols2 + hash + newLine; } gift += (mediumTop);

//medium gift += ("#".repeat(size) + symbol.repeat(size - 2) + "#" + "\\n");

//medium down let mediumDown = ""; for (let i = 0; i < size - 2; i++) { let hash = "#"; let symbols1 = symbol.repeat(size - 2); let symbols2 = symbol.repeat(size - i - 3); let newLine = "\\n";

mediumDown += hash + symbols1 + hash + symbols2 + hash + newLine; }

gift += (mediumDown);

//down gift += ("#".repeat(size) + "\\n"); return gift; }
