¿Qué imprime este código?
console.log(+true);
console.log(!"Lydia")
A: 1 y false
B: false y NaN
C: false y false
Respuesta en el primer comentario.
For further actions, you may consider blocking this person and/or reporting abuse
Need a better mental model for async/await?
Check out this classic DEV post on the subject.
Serpdog -
Heather Parker -
Teja Kummarikuntla -
Raja Tamil -
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)
La respuesta es:
A:
1 y false
El el primer caso, el operador
+
intenta convertir anumber
al valortrue
, por coerción de tipos javascript infiere atrue
como 1.En el segundo caso, intentamos negar un
string
, dichostring
es un valortruthy
, por ende, nuevamente por coerción de tipos javascript infiere alstring
"Lydia" comotrue
, y la negación detrue
esfalse