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 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: 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 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