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


Groups > comp.lang.javascript > #40990

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

From emf <emfril@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: JSLint: "Wrap a ternary expression in parens, ..."
Date 2022-07-15 14:19 -0400
Organization Aioe.org NNTP Server
Message-ID <tasb35$svu$1@gioia.aioe.org> (permalink)
References <tapv73$1pkf$1@gioia.aioe.org> <conditional-20220715072630@ram.dialup.fu-berlin.de>

Show all headers | View raw


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

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


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