return now.getDay()==5 && now.getDate==13;
Janis Papanagnou <janis_papanagnou@hotmail.com> writes:
return now.getDay()==5 && now.getDate==13;
There is a pair of parentheses missing above.
Today I was surprised that some old code did not work as I'd have
expected:
function friday_13th (now)
{
return now.getDay()==5 && now.getDate==13;
}
That function returned 'false' and also putting parenthesis around
the (sub-) expressions did not help. I had to use a local variable
to make that work:
function friday_13th (now)
{
var f13 = now.getDay()==5 && now.getDate()==13;
return f13;
}
Can anyone explain that please?
Janis
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 399 |
Nodes: | 16 (2 / 14) |
Uptime: | 76:36:48 |
Calls: | 8,359 |
Calls today: | 4 |
Files: | 13,160 |
Messages: | 5,895,492 |