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


Groups > comp.lang.javascript > #30906

Re: Any way to do this in JavaScript?

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From $Bill <news@todbe.com>
Newsgroups comp.lang.javascript
Subject Re: Any way to do this in JavaScript?
Date Tue, 19 Jul 2016 12:02:34 -0700
Organization A noiseless patient Spider
Lines 19
Message-ID <nmltgm$ctv$1@dont-email.me> (permalink)
References <nmln2h$kbr$1@dont-email.me> <nmlqm3$gms$1@news.albasani.net>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Tue, 19 Jul 2016 19:02:46 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="5b2cab364112ad98b7df59c61a581b22"; logging-data="13247"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18dejqu+tNE42PnWHhGK+SKaIqra4UNiA4="
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
In-Reply-To <nmlqm3$gms$1@news.albasani.net>
Cancel-Lock sha1:9qSKJiVgdvTRTrm/9Bpzc+r12nY=
Xref csiph.com comp.lang.javascript:30906

Show key headers only | View raw


On 7/19/2016 11:14, Martin Honnen wrote:
> On 19.07.2016 19:12, $Bill wrote:
>>
>>     var (title, chan, call, sTime, dur) = el.split('~~'); // do it all
>> in one like Perl
>>
>> Any way to do that?
>
> See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment, in Firefox and Chrome you should be able to use e.g.
>
>   var [title, chan, call, sTime, dur] = el.split('~~');
>
> See https://jsfiddle.net/rxjwajpn/.

I knew there had to be a way to do that - kind of an obscure part of the reference
manual though.  I'm looking under var and assignment type ref pages.

Much grass amigo, that worked perfectly.

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


Thread

Any way to do this in JavaScript? $Bill <news@todbe.com> - 2016-07-19 10:12 -0700
  Re: Any way to do this in JavaScript? Martin Honnen <martin.honnen@gmx.de> - 2016-07-19 20:14 +0200
    Re: Any way to do this in JavaScript? $Bill <news@todbe.com> - 2016-07-19 12:02 -0700
  Re: Any way to do this in JavaScript? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-19 21:05 +0200
    Re: Any way to do this in JavaScript? $Bill <news@todbe.com> - 2016-07-19 12:49 -0700
      Splitting strings (was: Any way to do this in JavaScript?) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-07-20 00:25 +0200
        Re: Splitting strings (was: Any way to do this in JavaScript?) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-07-20 09:45 +0200
  Re: Any way to do this in JavaScript? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-07-19 23:21 -0700
    Re: Any way to do this in JavaScript? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-07-20 10:56 +0200

csiph-web