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


Groups > comp.lang.javascript > #31822

Re: How to deal with "messy" quotes?

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: How to deal with "messy" quotes?
Date 2016-12-12 20:50 +0100
Organization PointedEars Software (PES)
Message-ID <2474381.88bMQJbFj6@PointedEars.de> (permalink)
References <e02b3e17-0584-4751-ac26-28897820e1c2@googlegroups.com> <quote-20161212120626@ram.dialup.fu-berlin.de> <ASI-20161212121701@ram.dialup.fu-berlin.de>

Show all headers | View raw


Stefan Ram wrote:

> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>justaguy <lichunshen84@gmail.com> writes:
>>>s.innerHTML = "&nbsp;" + fn +  " <input type='button' value='x'
>>To make it more readable, intersperse line breaks
>>s.innerHTML = "&nbsp;"
>>+ fn
>>+ " <input type='button' value='x'
> 
>   Due to automatic semicolon insertation, this might not always work.

This will always work.

>   Well. So, maybe:
> 
> s.innerHTML =
> "&nbsp;" +
> fn +
> " <input type='button' value='x'

Whatever operator code style you choose, the following lines should be 
indented:

  s.innerHTML = "&nbsp;" +
    fn +
    " <input type='button' value='x'…";

In implementations of ECMAScript 2016 one may forego the concatenation with 
a template literal:

  s.innerHTML = `&nbsp;${fn} <input type="button" value="x"…`;

Of course, accessing the “innerHTML” property is seldom justified to begin 
with.
 
>   ...
> 
>   (I first wrote it this way, but then I noticed that the
>   »+« sign was moving. So I wanted to align the »+« signs.)

That is what I do:

  s = "foo"
    + bar
    + "baz";

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

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


Thread

How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-11 16:23 -0800
  Re: How to deal with "messy" quotes? JJ <jj4public@vfemail.net> - 2016-12-12 12:42 +0700
    Re: How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-12 09:56 -0800
      Re: How to deal with "messy" quotes? JJ <jj4public@vfemail.net> - 2016-12-13 18:18 +0700
        Re: How to deal with "messy" quotes? JJ <jj4public@vfemail.net> - 2016-12-13 18:22 +0700
          Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-13 13:10 +0100
    Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-12 20:43 +0100
  Re: How to deal with "messy" quotes? <cyber@example.com> - 2016-12-12 17:53 +0000
    Re: How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-12 10:05 -0800
      Re: How to deal with "messy" quotes? <cyber@example.com> - 2016-12-12 18:15 +0000
        Re: How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-12 14:10 -0800
          Re: How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-12 16:56 -0800
            Re: How to deal with "messy" quotes? <cyber@example.com> - 2016-12-13 11:49 +0000
              Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-13 13:17 +0100
                Re: How to deal with "messy" quotes? <cyber@example.com> - 2016-12-13 18:32 +0000
                Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-13 19:47 +0100
                Re: How to deal with "messy" quotes? <cyber@example.com> - 2016-12-13 19:43 +0000
                Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-14 12:24 +0100
              Re: How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-13 17:07 -0800
    Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-12 21:19 +0100
      Re: How to deal with "messy" quotes? justaguy <lichunshen84@gmail.com> - 2016-12-12 12:51 -0800
  Re: How to deal with "messy" quotes? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-12 20:50 +0100

csiph-web