Extender el prototipo de Array

Published by xAlien95 in

Extiende la estructura de array agregando las siguientes propiedades calculadas y métodos:

  1. squared
  2. cubed
  3. divisible(by: x)
  4. strictly(above: x)
  5. strictly(below: x)

Ejemplos

[1, 2, 3].squared ➞ [1, 4, 9]

[1, 2, 3].cubed ➞ [1, 8, 27]

[1, 2, 3, 4].divisible(by: 2) ➞ [2, 4]

[1, 2, 3, 4].strictly(above: 1) ➞ [2, 3, 4]

[1, 2, 3, 4].strictly(below: 2) ➞ [1]

Notas

N/A