I'm sending a date to a .jade file from my .js file using Node.js
. When the #{date}
field is false
, it executes the else and print man
as it's answer. What could be going wrong?
if #{date} == false
| #{date}
else
| man
If date is false, do you want to output the string 'man'? If yes, your if and else statements are the wrong way around...
How about:
if date
= date
else
| man
or even:
| #{date ? date : 'man'}
or simply:
| #{date || 'man'}
Within if expression you write plain variable names, without #{...}
if date == false
| #{date}
else
| man
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With