X-Received: by 10.176.2.248 with SMTP id 111mr2867573uah.0.1495163615696; Thu, 18 May 2017 20:13:35 -0700 (PDT) X-Received: by 10.157.34.229 with SMTP id y92mr162768ota.15.1495163615487; Thu, 18 May 2017 20:13:35 -0700 (PDT) Path: csiph.com!3.us.feeder.erje.net!feeder.erje.net!2.us.feeder.erje.net!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!t26no342155qtg.1!news-out.google.com!v18ni2389ita.0!nntp.google.com!67no553875itx.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: alt.comp.lang.javascript Date: Thu, 18 May 2017 20:13:35 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=96.54.64.131; posting-account=6V9v2QoAAABpfeUESPWUmaYqAUZWpuCv NNTP-Posting-Host: 96.54.64.131 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Any way to do this in JavaScript? From: kintalken@gmail.com Injection-Date: Fri, 19 May 2017 03:13:35 +0000 Content-Type: text/plain; charset="UTF-8" Lines: 17 Xref: csiph.com alt.comp.lang.javascript:7 On Monday, July 18, 2016 at 11:40:28 PM UTC-7, $Bill wrote: > In Perl, I have: > > my ($title, $chan, $call, $sTime, $dur) = split /~~/, $el; $el = 'a~~b~~c~~d~~e' ; [$title, $chan, $call, $sTime, $dur] = $el.split('~~') ; console.log({title : $title , chan : $chan , call : $call , sTime : $sTime , dur : $dur}) ; => { title: 'a', chan: 'b', call: 'c', sTime: 'd', dur: 'e' } .c.f. "deconstruction" https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment ~~ kintalken ~~