Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #41165

Simple question on boolean function return value

Path csiph.com!1.us.feeder.erje.net!3.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!news.uzoreto.com!aioe.org!l0a7mbpMAnmInR5ez9Z/yg.user.46.165.242.75.POSTED!not-for-mail
From Janis Papanagnou <janis_papanagnou@hotmail.com>
Newsgroups comp.lang.javascript
Subject Simple question on boolean function return value
Date Fri, 13 Jan 2023 15:56:49 +0100
Organization Aioe.org NNTP Server
Message-ID <tprrfh$4ve$1@gioia.aioe.org> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
Injection-Info gioia.aioe.org; logging-data="5102"; posting-host="l0a7mbpMAnmInR5ez9Z/yg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
X-Notice Filtered by postfilter v. 0.9.2
X-Enigmail-Draft-Status N1110
X-Mozilla-News-Host news://nntp.aioe.org:119
Xref csiph.com comp.lang.javascript:41165

Show key headers only | View raw


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


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