Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #40991
| From | emf <emfril@gmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: JSLint: "Wrap a ternary expression in parens, ..." |
| Date | 2022-07-15 14:24 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <tasbct$11ej$1@gioia.aioe.org> (permalink) |
| References | <tapv73$1pkf$1@gioia.aioe.org> <ff42c0ad-120d-4a19-9a04-e4b47f2b0a92n@googlegroups.com> |
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
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
JSLint: "Wrap a ternary expression in parens, ..." emf <emfril@gmail.com> - 2022-07-14 16:44 -0400
Re: JSLint: "Wrap a ternary expression in parens, ..." "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2022-07-15 08:40 -0700
Re: JSLint: "Wrap a ternary expression in parens, ..." emf <emfril@gmail.com> - 2022-07-15 14:24 -0400
Re: JSLint: "Wrap a ternary expression in parens, ..." "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2022-07-16 08:37 -0700
Re: JSLint: "Wrap a ternary expression in parens, ..." emf <emfril@gmail.com> - 2022-07-16 17:46 -0400
Re: JSLint: "Wrap a ternary expression in parens, ..." emf <emfril@gmail.com> - 2022-07-16 17:27 -0400
Re: JSLint: "Wrap a ternary expression in parens, ..." emf <emfril@gmail.com> - 2022-07-15 14:19 -0400
csiph-web