Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 586 Bytes

challenge-06.md

File metadata and controls

24 lines (18 loc) · 586 Bytes

Reto 6: Creando adornos navideños

🔗 Enunciado

Solución

function createCube(size) {
  let basicStructure = ''

  Array.from({ length: size }, (_, i) => i + 1).forEach((i) => {
    basicStructure +=
      ' '.repeat(size - i) + '/\\'.repeat(i) + '_\\'.repeat(size) + '\n'
  })
  Array.from({ length: size }, (_, i) => size - i).forEach((i) => {
    basicStructure += ' '.repeat(size - i) + '\\/'.repeat(i) + '_/'.repeat(size)
    if (i !== 1) basicStructure += '\n'
  })

  return basicStructure
}

🚀 120 puntos