Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: $Bill 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: References: 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: Cancel-Lock: sha1:9qSKJiVgdvTRTrm/9Bpzc+r12nY= Xref: csiph.com comp.lang.javascript:30906 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.