Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Make it myself? But I'm a physical organic chemist!


devel / comp.lang.javascript / JSLint: "Wrap a ternary expression in parens, ..."

SubjectAuthor
* JSLint: "Wrap a ternary expression in parens, ..."emf
+* Re: JSLint: "Wrap a ternary expression in parens, ..."Stefan Ram
|`- Re: JSLint: "Wrap a ternary expression in parens, ..."emf
`* Re: JSLint: "Wrap a ternary expression in parens, ..."Michael Haufe (TNO)
 `* Re: JSLint: "Wrap a ternary expression in parens, ..."emf
  +* Re: JSLint: "Wrap a ternary expression in parens, ..."Stefan Ram
  |+* Re: JSLint: "Wrap a ternary expression in parens, ..."Stefan Ram
  ||`- Re: JSLint: "Wrap a ternary expression in parens, ..."emf
  |`- Re: JSLint: "Wrap a ternary expression in parens, ..."Thomas 'PointedEars' Lahn
  `* Re: JSLint: "Wrap a ternary expression in parens, ..."Michael Haufe (TNO)
   `- Re: JSLint: "Wrap a ternary expression in parens, ..."emf

1
JSLint: "Wrap a ternary expression in parens, ..."

<tapv73$1pkf$1@gioia.aioe.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=5340&group=comp.lang.javascript#5340

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!aioe.org!PciQ4lDHv7AA88MNUkMuTg.user.46.165.242.91.POSTED!not-for-mail
From: emfril@gmail.com (emf)
Newsgroups: comp.lang.javascript
Subject: JSLint: "Wrap a ternary expression in parens, ..."
Date: Thu, 14 Jul 2022 16:44:18 -0400
Organization: Aioe.org NNTP Server
Message-ID: <tapv73$1pkf$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="59023"; posting-host="PciQ4lDHv7AA88MNUkMuTg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: emf - Thu, 14 Jul 2022 20:44 UTC

Hi.

JSLint now does not like this code (that it used to find OK), saying

"Wrap a ternary expression in parens, with a line break after
the left paren."

=================
orb = (orb0Btn.checked)
? 0
: (orb5Btn.checked)
? 5
: (orb10Btn.checked)
? 10
: (orb15Btn.checked)
? 15
: 20;
=================

What is now the correct syntax for the ternary expression?

Thanks,

Eustace
--
Natal Transits Calculator
https://emf.neocities.org/nt/nataltransits2.html

Re: JSLint: "Wrap a ternary expression in parens, ..."

<conditional-20220715072630@ram.dialup.fu-berlin.de>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=5341&group=comp.lang.javascript#5341

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.javascript
Subject: Re: JSLint: "Wrap a ternary expression in parens, ..."
Date: 15 Jul 2022 06:27:13 GMT
Organization: Stefan Ram
Lines: 16
Expires: 1 Apr 2023 11:59:58 GMT
Message-ID: <conditional-20220715072630@ram.dialup.fu-berlin.de>
References: <tapv73$1pkf$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de yurT+Unr5fgF8XLM6FY9tg7OVdKJPGOLyywiox9AuUMXuB
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Fri, 15 Jul 2022 06:27 UTC

emf <emfril@gmail.com> writes:
>What is now the correct syntax for the ternary expression?

IIRC, JSLint does not check syntax but its authors idea of style.

The syntax for the conditional expression is

ConditionalExpression[In, Yield, Await] :
ShortCircuitExpression[?In, ?Yield, ?Await]
ShortCircuitExpression[?In, ?Yield, ?Await] ? AssignmentExpression[+In, ?Yield, ?Await] :
AssignmentExpression[?In, ?Yield, ?Await]

, so, you can just write, for example, "0?1:1?2:3"
(which would evaluate to 2).

Re: JSLint: "Wrap a ternary expression in parens, ..."

<ff42c0ad-120d-4a19-9a04-e4b47f2b0a92n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=5342&group=comp.lang.javascript#5342

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:a37:917:0:b0:6b5:b9a4:bdda with SMTP id 23-20020a370917000000b006b5b9a4bddamr8891634qkj.36.1657899611836;
Fri, 15 Jul 2022 08:40:11 -0700 (PDT)
X-Received: by 2002:a37:414b:0:b0:6b5:7da7:2f97 with SMTP id
o72-20020a37414b000000b006b57da72f97mr9786245qka.190.1657899611656; Fri, 15
Jul 2022 08:40:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Fri, 15 Jul 2022 08:40:11 -0700 (PDT)
In-Reply-To: <tapv73$1pkf$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:6000:8900:6915:754d:9b20:5ab3:157e;
posting-account=hYRygAoAAABkmvJVmPilz9Q1TOjgPQAq
NNTP-Posting-Host: 2603:6000:8900:6915:754d:9b20:5ab3:157e
References: <tapv73$1pkf$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ff42c0ad-120d-4a19-9a04-e4b47f2b0a92n@googlegroups.com>
Subject: Re: JSLint: "Wrap a ternary expression in parens, ..."
From: tno@thenewobjective.com (Michael Haufe (TNO))
Injection-Date: Fri, 15 Jul 2022 15:40:11 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 37
 by: Michael Haufe (TNO) - Fri, 15 Jul 2022 15:40 UTC

On Thursday, July 14, 2022 at 3:44:28 PM UTC-5, emf wrote:
> Hi.
>
> JSLint now does not like this code (that it used to find OK), saying
>
> "Wrap a ternary expression in parens, with a line break after
> the left paren."
>
> =================
> orb = (orb0Btn.checked)
> ? 0
> : (orb5Btn.checked)
> ? 5
> : (orb10Btn.checked)
> ? 10
> : (orb15Btn.checked)
> ? 15
> : 20;
> =================
>
> What is now the correct syntax for the ternary expression?

It's just a jslint setting. You can turn that off I'm pretty sure.

I think it wants:

(
p ? truePart : (
p ? truePart : falsePart
)
)

I think this is because nested ternaries can be a little hard to read if you don't format them properly.

I prefer ESLint

Re: JSLint: "Wrap a ternary expression in parens, ..."

<tasb35$svu$1@gioia.aioe.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=5343&group=comp.lang.javascript#5343

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!aioe.org!rEIP5qHyzg2o27z2J/u4LQ.user.46.165.242.91.POSTED!not-for-mail
From: emfril@gmail.com (emf)
Newsgroups: comp.lang.javascript
Subject: Re: JSLint: "Wrap a ternary expression in parens, ..."
Date: Fri, 15 Jul 2022 14:19:16 -0400
Organization: Aioe.org NNTP Server
Message-ID: <tasb35$svu$1@gioia.aioe.org>
References: <tapv73$1pkf$1@gioia.aioe.org>
<conditional-20220715072630@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="29694"; posting-host="rEIP5qHyzg2o27z2J/u4LQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: emf - Fri, 15 Jul 2022 18:19 UTC

On 2022-07-15 02:27, Stefan Ram wrote:
> emf <emfril@gmail.com> writes:
>> What is now the correct syntax for the ternary expression?
>
> IIRC, JSLint does not check syntax but its authors idea of style.
>
> The syntax for the conditional expression is
>
> ConditionalExpression[In, Yield, Await] :
> ShortCircuitExpression[?In, ?Yield, ?Await]
> ShortCircuitExpression[?In, ?Yield, ?Await] ? AssignmentExpression[+In, ?Yield, ?Await] :
> AssignmentExpression[?In, ?Yield, ?Await]
>
> , so, you can just write, for example, "0?1:1?2:3"
> (which would evaluate to 2).

Brilliant! :)

Re: JSLint: "Wrap a ternary expression in parens, ..."

<tasbct$11ej$1@gioia.aioe.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=5344&group=comp.lang.javascript#5344

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!aioe.org!rEIP5qHyzg2o27z2J/u4LQ.user.46.165.242.91.POSTED!not-for-mail
From: emfril@gmail.com (emf)
Newsgroups: comp.lang.javascript
Subject: Re: JSLint: "Wrap a ternary expression in parens, ..."
Date: Fri, 15 Jul 2022 14:24:28 -0400
Organization: Aioe.org NNTP Server
Message-ID: <tasbct$11ej$1@gioia.aioe.org>
References: <tapv73$1pkf$1@gioia.aioe.org>
<ff42c0ad-120d-4a19-9a04-e4b47f2b0a92n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="34259"; posting-host="rEIP5qHyzg2o27z2J/u4LQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: emf - Fri, 15 Jul 2022 18:24 UTC

On 2022-07-15 11:40, Michael Haufe (TNO) wrote:
> On Thursday, July 14, 2022 at 3:44:28 PM UTC-5, emf wrote:
>> Hi.
>>
>> JSLint now does not like this code (that it used to find OK), saying
>>
>> "Wrap a ternary expression in parens, with a line break after
>> the left paren."
>>
>> =================
>> orb = (orb0Btn.checked)
>> ? 0
>> : (orb5Btn.checked)
>> ? 5
>> : (orb10Btn.checked)
>> ? 10
>> : (orb15Btn.checked)
>> ? 15
>> : 20;
>> =================
>>
>> What is now the correct syntax for the ternary expression?
>
> It's just a jslint setting. You can turn that off I'm pretty sure.
>
> I think it wants:
>
> (
> p ? truePart : (
> p ? truePart : falsePart
> )
> )
>
>
> I think this is because nested ternaries can be a little hard to read if you don't format them properly.
>
> I prefer ESLint

OK, JSLint does not find anything wrong with this

orb = ((orb0Btn.checked)
? 0
: (orb5Btn.checked)
? 5
: (orb10Btn.checked)
? 10
: (orb15Btn.checked)
? 15
: 20);

The only now warning is:

1. Bad assignment to 'panel'. 89.5
panel = document.getElementById("panel");

however the program (see sig below in (nataltransits2.js) still
does not work...

Eustace
--
Natal Transits Calculator
https://emf.neocities.org/nt/nataltransits2.html

Re: JSLint: "Wrap a ternary expression in parens, ..."

<formatting-20220715193854@ram.dialup.fu-berlin.de>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=5345&group=comp.lang.javascript#5345

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.javascript
Subject: Re: JSLint: "Wrap a ternary expression in parens, ..."
Date: 15 Jul 2022 18:41:12 GMT
Organization: Stefan Ram
Lines: 40
Expires: 1 Apr 2023 11:59:58 GMT
Message-ID: <formatting-20220715193854@ram.dialup.fu-berlin.de>
References: <tapv73$1pkf$1@gioia.aioe.org> <ff42c0ad-120d-4a19-9a04-e4b47f2b0a92n@googlegroups.com> <tasbct$11ej$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de Ifj2l7BMICtM9/iZ4Hi0KAhd5Cy/SAl6U1POVLMKrFlhkQ
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Fri, 15 Jul 2022 18:41 UTC

emf <emfril@gmail.com> writes:
>orb = ((orb0Btn.checked)
> ? 0
> : (orb5Btn.checked)
> ? 5
> : (orb10Btn.checked)
> ? 10
> : (orb15Btn.checked)
> ? 15
> : 20);

I'd ignore whatever JSLint says about this and
use the following formatting:

orb =
orb0Btn.checked? 0:
orb5Btn.checked? 5:
orb10Btn.checked? 10:
orb15Btn.checked? 15:
20;

. This is so much clearer and easier to read.
No need to harp on the fact that it's formally
a nested structure.

1 + 2 + 3 + 4 + 5

also actually is nested:

((( 1 + 2 )
+ 3 )
+ 4 )
+ 5

because it is being parsed left-associatively.
Still we do not add parentheses and indentations
to make it look that complicated and difficult
to read.

Re: JSLint: "Wrap a ternary expression in parens, ..."

<formatting-20220716131733@ram.dialup.fu-berlin.de>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=5346&group=comp.lang.javascript#5346

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news.in-chemnitz.de!news2.arglkargh.de!news.karotte.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.javascript
Subject: Re: JSLint: "Wrap a ternary expression in parens, ..."
Date: 16 Jul 2022 12:19:51 GMT
Organization: Stefan Ram
Lines: 22
Expires: 1 Apr 2023 11:59:58 GMT
Message-ID: <formatting-20220716131733@ram.dialup.fu-berlin.de>
References: <tapv73$1pkf$1@gioia.aioe.org> <ff42c0ad-120d-4a19-9a04-e4b47f2b0a92n@googlegroups.com> <tasbct$11ej$1@gioia.aioe.org> <formatting-20220715193854@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de DJRYIx7je3xZDNZVtSznOgeohtYsksdG1ONheqYsx/1kAj
X-Copyright: (C) Copyright 2022 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE, en-US, it, fr-FR
 by: Stefan Ram - Sat, 16 Jul 2022 12:19 UTC

ram@zedat.fu-berlin.de (Stefan Ram) writes:
>orb =
>orb0Btn.checked? 0:
>orb5Btn.checked? 5:
>orb10Btn.checked? 10:
>orb15Btn.checked? 15:
> 20;

Or,

orb =
orb0Btn. checked? 0:
orb5Btn. checked? 5:
orb10Btn.checked? 10:
orb15Btn.checked? 15:
20;

. Now, imagine that someone does not know all details of the
ternary operator well, but has a basic idea of it. In which
way could he be mislead by this?

Re: JSLint: "Wrap a ternary expression in parens, ..."

<8fdd197b-5ad1-4d87-8358-40a1d7cb559fn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=5347&group=comp.lang.javascript#5347

  copy link   Newsgroups: comp.lang.javascript
X-Received: by 2002:ac8:4e83:0:b0:31e:e139:a6a8 with SMTP id 3-20020ac84e83000000b0031ee139a6a8mr4598682qtp.337.1657985851740;
Sat, 16 Jul 2022 08:37:31 -0700 (PDT)
X-Received: by 2002:a05:6830:4d5:b0:61c:7abb:7cba with SMTP id
s21-20020a05683004d500b0061c7abb7cbamr5288557otd.327.1657985851473; Sat, 16
Jul 2022 08:37:31 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Sat, 16 Jul 2022 08:37:31 -0700 (PDT)
In-Reply-To: <tasbct$11ej$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:6000:8900:6915:3cf5:c206:d01a:2bcf;
posting-account=hYRygAoAAABkmvJVmPilz9Q1TOjgPQAq
NNTP-Posting-Host: 2603:6000:8900:6915:3cf5:c206:d01a:2bcf
References: <tapv73$1pkf$1@gioia.aioe.org> <ff42c0ad-120d-4a19-9a04-e4b47f2b0a92n@googlegroups.com>
<tasbct$11ej$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8fdd197b-5ad1-4d87-8358-40a1d7cb559fn@googlegroups.com>
Subject: Re: JSLint: "Wrap a ternary expression in parens, ..."
From: tno@thenewobjective.com (Michael Haufe (TNO))
Injection-Date: Sat, 16 Jul 2022 15:37:31 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 44
 by: Michael Haufe (TNO) - Sat, 16 Jul 2022 15:37 UTC

On Friday, July 15, 2022 at 1:24:37 PM UTC-5, emf wrote:
> [...]
> The only now warning is:
>
> 1. Bad assignment to 'panel'. 89.5
> panel = document.getElementById("panel");
>
> however the program (see sig below in (nataltransits2.js) still
> does not work...
> Eustace

ESLint points out a number of issues remaining:

<https://emf.neocities.org/nt/nataltransits2.js>

11:9 'ephem' is not defined. (no-undef)

15:16 'ephem' is not defined. (no-undef)

19:9 'ephem' is not defined. (no-undef)

20:9 'ephem' is not defined. (no-undef)

29:9 'reader' is not defined. (no-undef)

30:16 'reader' is not defined. (no-undef)

38:5 'reader' is not defined. (no-undef)

39:5 'reader' is not defined. (no-undef)

40:5 'reader' is not defined. (no-undef)

49:16 'getBDay' is not defined. (no-undef)

81:9 'findTransits' is not defined. (no-undef)

83:9 'panel' is not defined. (no-undef)

89:5 'panel' is not defined. (no-undef)

91:22 'e' is defined but never used. (no-unused-vars)

You have to declare a variable before assigning to it.

Re: JSLint: "Wrap a ternary expression in parens, ..."

<tavah4$nfj$1@gioia.aioe.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=5348&group=comp.lang.javascript#5348

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!aioe.org!9gyBk1y4Nxyc8575/X9TpA.user.46.165.242.91.POSTED!not-for-mail
From: emfril@gmail.com (emf)
Newsgroups: comp.lang.javascript
Subject: Re: JSLint: "Wrap a ternary expression in parens, ..."
Date: Sat, 16 Jul 2022 17:27:59 -0400
Organization: Aioe.org NNTP Server
Message-ID: <tavah4$nfj$1@gioia.aioe.org>
References: <tapv73$1pkf$1@gioia.aioe.org>
<ff42c0ad-120d-4a19-9a04-e4b47f2b0a92n@googlegroups.com>
<tasbct$11ej$1@gioia.aioe.org>
<formatting-20220715193854@ram.dialup.fu-berlin.de>
<formatting-20220716131733@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="24051"; posting-host="9gyBk1y4Nxyc8575/X9TpA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: emf - Sat, 16 Jul 2022 21:27 UTC

On 2022-07-16 08:19, Stefan Ram wrote:
> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>> orb =
>> orb0Btn.checked? 0:
>> orb5Btn.checked? 5:
>> orb10Btn.checked? 10:
>> orb15Btn.checked? 15:
>> 20;
>
> Or,
>
> orb =
> orb0Btn. checked? 0:
> orb5Btn. checked? 5:
> orb10Btn.checked? 10:
> orb15Btn.checked? 15:
> 20;
>
> . Now, imagine that someone does not know all details of the
> ternary operator well, but has a basic idea of it. In which
> way could he be mislead by this?

Thanks! Your idea is very simple and easy to understand!

emf
--
Natal Transits Calculator
https://emf.neocities.org/nt/nataltransits2.html

Re: JSLint: "Wrap a ternary expression in parens, ..."

<tavbjb$12sf$1@gioia.aioe.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=5349&group=comp.lang.javascript#5349

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!aioe.org!9gyBk1y4Nxyc8575/X9TpA.user.46.165.242.91.POSTED!not-for-mail
From: emfril@gmail.com (emf)
Newsgroups: comp.lang.javascript
Subject: Re: JSLint: "Wrap a ternary expression in parens, ..."
Date: Sat, 16 Jul 2022 17:46:17 -0400
Organization: Aioe.org NNTP Server
Message-ID: <tavbjb$12sf$1@gioia.aioe.org>
References: <tapv73$1pkf$1@gioia.aioe.org>
<ff42c0ad-120d-4a19-9a04-e4b47f2b0a92n@googlegroups.com>
<tasbct$11ej$1@gioia.aioe.org>
<8fdd197b-5ad1-4d87-8358-40a1d7cb559fn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="35727"; posting-host="9gyBk1y4Nxyc8575/X9TpA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: emf - Sat, 16 Jul 2022 21:46 UTC

On 2022-07-16 11:37, Michael Haufe (TNO) wrote:
> On Friday, July 15, 2022 at 1:24:37 PM UTC-5, emf wrote:
>> [...]
>> The only now warning is:
>>
>> 1. Bad assignment to 'panel'. 89.5
>> panel = document.getElementById("panel");
>>
>> however the program (see sig below in (nataltransits2.js) still
>> does not work...
>> Eustace
>
> ESLint points out a number of issues remaining:
>
> <https://emf.neocities.org/nt/nataltransits2.js>
>
> 11:9 'ephem' is not defined. (no-undef)
>
> 15:16 'ephem' is not defined. (no-undef)
>
> 19:9 'ephem' is not defined. (no-undef)
>
> 20:9 'ephem' is not defined. (no-undef)
>
> 29:9 'reader' is not defined. (no-undef)
>
> 30:16 'reader' is not defined. (no-undef)
>
> 38:5 'reader' is not defined. (no-undef)
>
> 39:5 'reader' is not defined. (no-undef)
>
> 40:5 'reader' is not defined. (no-undef)
>
> 49:16 'getBDay' is not defined. (no-undef)
>
> 81:9 'findTransits' is not defined. (no-undef)
>
> 83:9 'panel' is not defined. (no-undef)
>
> 89:5 'panel' is not defined. (no-undef)
>
> 91:22 'e' is defined but never used. (no-unused-vars)
>
>
> You have to declare a variable before assigning to it.

There was only 1 warning because in the process of JSLinting I
had added imported globals. This was nataltransits2.js, and
there is also a nataltransits.js,

Well, I have to start checking the program from the beginning to
find out where the bug is. Then I may seek the advise of this
newsgroup again.

The thing is that the webpage was working fine before... I'm
thinking of starting to comment out one "use strict" at a time,
to see if at some point the program will start working again...

Thanks to all,

Eustace
--
Natal Transits Calculator
https://emf.neocities.org/nt/nataltransits2.html

Re: JSLint: "Wrap a ternary expression in parens, ..."

<4427809.LvFx2qVVIh@PointedEars.de>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=5379&group=comp.lang.javascript#5379

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!news.alphanet.ch!alphanet.ch!news.imp.ch!newsreader4.netcologne.de!news.netcologne.de!news.nobody.at!news.mb-net.net!open-news-network.org!.POSTED.178.197.201.88!not-for-mail
From: PointedEars@web.de (Thomas 'PointedEars' Lahn)
Newsgroups: comp.lang.javascript
Subject: Re: JSLint: "Wrap a ternary expression in parens, ..."
Date: Mon, 25 Jul 2022 04:17:51 +0200
Organization: PointedEars Software (PES)
Lines: 34
Message-ID: <4427809.LvFx2qVVIh@PointedEars.de>
References: <tapv73$1pkf$1@gioia.aioe.org> <ff42c0ad-120d-4a19-9a04-e4b47f2b0a92n@googlegroups.com> <tasbct$11ej$1@gioia.aioe.org> <formatting-20220715193854@ram.dialup.fu-berlin.de>
Reply-To: Thomas 'PointedEars' Lahn <usenet@PointedEars.de>
Mime-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7Bit
Injection-Info: gwaiyur.mb-net.net; posting-host="178.197.201.88";
logging-data="189669"; mail-complaints-to="abuse@open-news-network.org"
User-Agent: KNode/4.14.10
Cancel-Lock: sha1:nZloMOKmSWZtIAIcUWVCDuC/m9k=
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
X-User-ID: U2FsdGVkX1+UeUJI0qyugaZLp3OIJj8pgJLocolxx6KFY8JKFRmoMA==
X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
 by: Thomas 'Pointed - Mon, 25 Jul 2022 02:17 UTC

Stefan Ram wrote:

> emf <emfril@gmail.com> writes:
>>orb = ((orb0Btn.checked)
>> ? 0
>> : (orb5Btn.checked)
>> ? 5
>> : (orb10Btn.checked)
>> ? 10
>> : (orb15Btn.checked)
>> ? 15
>> : 20);
>
> I'd ignore whatever JSLint says about this and
> use the following formatting:
>
> orb =
> orb0Btn.checked? 0:
> orb5Btn.checked? 5:
> orb10Btn.checked? 10:
> orb15Btn.checked? 15:
> 20;

I would ignore and am ignoring whatever you propose about writing style
because IMHO your writing style is that of a madman. Always has been.

Every single one of your programs that I have seen so far, no matter the
programming language, is next to unreadable and unmaintainable, disregarding
any conventions that exist for that language.

--
PointedEars
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2
Please do not cc me. /Bitte keine Kopien per E-Mail.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor