Another one of those "pro-dev" things that can be a bit confusing is this for only positive conditionals:
condition && console.log("Was here")
I can never make my mind up if I like it - I do write that when debugging, but pretty much never in "real code"
It works with everything apart from assignment which requires brackets
condition1 && condition2 && (something = somethingElse)
Again not advocating, but it is out there in people's code.
Thank goodness of optional chaining though (thanks babel) so my if's can go from:
if(someObject && someObject.subObject&& someObject.subObject.value > 299) { //whatever }
to
if(someObject?.subObject?.value > 299) { }
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.
Another one of those "pro-dev" things that can be a bit confusing is this for only positive conditionals:
I can never make my mind up if I like it - I do write that when debugging, but pretty much never in "real code"
It works with everything apart from assignment which requires brackets
Again not advocating, but it is out there in people's code.
Thank goodness of optional chaining though (thanks babel) so my if's can go from:
to