¿Qué imprime este código JavaScript?
console.log(3 + 4 + "5");
- A:
"345"
- B:
"75"
- C:
12
- D:
75
Respuesta en el primer comentario.
For further actions, you may consider blocking this person and/or reporting abuse
Jason F -
Chiyen Venegas -
Silvestar Bistrović -
Bervianto Leo Pratama -
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 (1)
Respuesta:
"75"
El código JavaScript se ejecuta de arriba hacia abajo y de izquiera a derecha.
Primero realizamos la suma
3 + 4
, puesto que ambos son de tiponumber
; obtenemos7
.Ahora tenemos
7 + "5"
, como"5"
es de tipostring
, ahora realizamos una concatenación de valores y porcoerción de tipos
el resultado final seria"75"
comostring
.