In JavaScript, can I always use boolean OR instead of conditional operator for all kind of variables (e.g. string, function, ...)?
For example z = (x || y)
Depends what you are trying to achieve. If you are dealing with strings for instance (x || y) translates to "if string x is not null/empty OR string y is not null/empty" then return 1/true whereas (x ? x : y) translates to "ifstring x is not null/empty then return x otherwise (if it is empty/null) return y".
So the first approach will always return you a boolean 1/0 or true/false whereas the second one will return you one of the actual values of the 2 variables.
Having said that, if you want to use the result (z) in another if(z) then they are equivalent.