¿Qué imprime este código JavaScript?
function getAge(...args) {
console.log(typeof args);
}
getAge(21);
- A:
"number"
- B:
"array"
- C:
"object"
- D:
"NaN"
Respuesta en el primer comentario.
For further actions, you may consider blocking this person and/or reporting abuse
Akbar Julian Khatibi -
Madza -
Max Daunarovich -
Sardar Mudassar Ali Khan -
Once suspended, duxtech will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, duxtech will be able to comment and publish posts again.
Once unpublished, all posts by duxtech will become hidden and only accessible to themselves.
If duxtech is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Cristian Fernando .
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community safe. Here is what you can do to flag duxtech:
Unflagging duxtech will restore default visibility to their posts.
Top comments (4)
Respuesta:
"object"
Cuando usamos la sintaxis de
...
en los parámetros de una función (Rest Operator desde ES6) convertimos a dicho parámetro a un arreglo. Entonces es tentador marcar la opción B:"array"
pero esto sería un error de novato. En JavaScript no existe el tipo de datoarray
, para tipos no primitivos el lenguaje los evalua comoobject
. Por ese motivo la respuesta correcta es la opción C:"object"
.Niice
Paracetamol.js💊?
Wow, I loved that...
Mmm creo que ha de ser un iterable... apuesto un cuack a que es object