You're wrong i think.
status && something()
is not equal to
if (status && logSomething()) {};
It is equal to
if (status) { return something() } else { return status }
If you want to assign variables with Logical &&. You can do like this :
let something = ""; status && (something = "This works");
an other example :
console.log(0 && 5) // will return 0
but
console.log(1 && 5) // will return 5
Thanks for taking your time to explain
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You're wrong i think.
is not equal to
It is equal to
If you want to assign variables with Logical &&. You can do like this :
an other example :
but
Thanks for taking your time to explain