I would not call it bizarre and it is not specific to Javascript. You can do this in lots of languages like Java, C++ and even Perl.
The fact that you can use && and || as control structures is a consequence of short circuit evaluation and that is something every programmer should understand.
I do agree that these operators have not been introduced for this purpose and that this style can be less readable.
They are quite handy when you need to get a property nested in an object, like let foo = obj && obj.child && obj.child.foo || "", especially when a default fallback value is needed.
But when it's used as a condition, it's a bit annoying and IMO much less readable at first glance.
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.
I would not call it bizarre and it is not specific to Javascript. You can do this in lots of languages like Java, C++ and even Perl.
The fact that you can use && and || as control structures is a consequence of short circuit evaluation and that is something every programmer should understand.
I do agree that these operators have not been introduced for this purpose and that this style can be less readable.
They are quite handy when you need to get a property nested in an object, like
let foo = obj && obj.child && obj.child.foo || ""
, especially when a default fallback value is needed.But when it's used as a condition, it's a bit annoying and IMO much less readable at first glance.