Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #41165
| From | Janis Papanagnou <janis_papanagnou@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Simple question on boolean function return value |
| Date | 2023-01-13 15:56 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <tprrfh$4ve$1@gioia.aioe.org> (permalink) |
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
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
Simple question on boolean function return value Janis Papanagnou <janis_papanagnou@hotmail.com> - 2023-01-13 15:56 +0100 Re: Simple question on boolean function return value Janis Papanagnou <janis_papanagnou@hotmail.com> - 2023-01-13 16:23 +0100 Re: Simple question on boolean function return value V V V V V V V V V V V V V V V V V V <vvvvvvvvaaaaaaaaaaaaaaa@mail.ee> - 2023-01-28 09:05 -0800
csiph-web