DEV Community

Cristian Fernando
Cristian Fernando

Posted on

1

Paracetamol.ts💊| #28: Explica este código TypeScript

Explica este código TypeScript

Dificultad: Intermedio

let z:number[][];
Enter fullscreen mode Exit fullscreen mode

¿Cuál de los siguientes arreglos es asignable a z?

  • A. [ [255, 255, 255], [0, 0, 0], [2, 2.2] ]
  • B. [ ["hola"], ["mundo"] ]
  • C. [ [2n, 4n], [2,4] ]
  • D. Todos los anteriores
  • E. Ninguno de los anteriores

Respuesta

✅ A. [ [255, 255, 255], [0, 0, 0], [2, 2.2] ]

La sintaxis de z expresa que solo acepta arreglos de arreglos (matriz) siempre y cuando sean numéricos.
B. y C. cumplen con la condición de ser matrices pero contienen cadenas y big ints, por ello no son asignables a z.


Puedes ver el último reto aqui:

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)