Code-wise I think this has been covered but I would note that what you're doing here is linguistically very different and is likely to have a very different effect on people reading your code, and perhaps the subconscious of those merely navigating front-end of the website (people with even a passing involvement with or knowledge of code may find themselves psychologically influenced by the underlying 'symbolic links'*). To break this down further, let's consider a string value for x
:
var x = "spoon";
print(x if x else 'no x available')
# compared to:
print(x and x or 'no x available')
It's still difficult to see exactly what will happen to "spoon" here, so to make things clearer we could just call our variable "hasSpoon" instead of assigning it a string (but you can believe we've assigned it a string of "spoon" too if you like...):
print(hasSpoon if hasSpoon is true else 'no hasSpoon available')
# compared to:
print(hasSpoon and hasSpoon or 'no hasSpoon available')
As we can see, in the first instance the logical reading would be that our metaphorical cutlery wielder has a spoon if they have a spoon, which I think we will probably agree on (and on the other hand they have the condition of not having a spoon available to them, rather than not actually having a spoon which is a little odd, but possible, but let's leave it aside for now.)
In the second expression the logical implication is rather that our theoretical diner has a spoon and also has a spoon, which is tautological in a whole other way.
So, if you wanted to express to any would-be readers of the code, and also anyone who might be potentially influenced by it by-proxy, that people who have spoons are very likely to have spoons, and those that don't have the option to not have a spoon, you would use the first option. If, on the other hand, you wished to express that a particular person both has a spoon and has a spoon, or else they have the condition of not having a spoon open to them, you would use the second expression.
Or something.
*I use the term symbolically here, if you'll pardon the pun.