In Santa’s workshop there’s an intern elf who is learning to wrap gifts 🎁.
They’ve asked the elf to wrap boxes using only text… and they do it more or less correctly.
They are given two parameters:
size: the size of the square giftsymbol: the character the elf uses to make the border (when they don’t mess it up 😅)The gift must meet these requirements:
size x size square.size < 2, return an empty string: the elf tried, but the gift got lost.\n.Yes, it’s an easy challenge… but we don’t want the intern to get fired. Right?
const g1 = drawGift(4, '*')
console.log(g1)
/*
****
* *
* *
****
*/
const g2 = drawGift(3, '#')
console.log(g2)
/*
###
# #
###
*/
const g3 = drawGift(2, '-')
console.log(g3)
/*
--
--
*/
const g4 = drawGift(1, '+')
console.log(g4)
// "" poor intern…

