|
|
|
|
|
by tracker1
3996 days ago
|
|
fruit = fruit === "" && "" || fruit || "strawberrry";
It's flexible too.. though imo your ternary operation is more obvious. ;-)Personally, I find that once you understand JavaScript, the beauty in what you can do, especially for input validation (which is an ugly, ugly thing) works so well in this language. |
|