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


Groups > alt.comp.lang.javascript > #7

Re: Any way to do this in JavaScript?

Newsgroups alt.comp.lang.javascript
Date 2017-05-18 20:13 -0700
References <nmki0q$nl9$1@dont-email.me>
Message-ID <fca84d5d-c7e1-417a-a2a6-e1150dfaed06@googlegroups.com> (permalink)
Subject Re: Any way to do this in JavaScript?
From kintalken@gmail.com

Show all headers | View raw


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 ~~

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


Thread

Any way to do this in JavaScript? $Bill <news@todbe.com> - 2016-07-18 23:40 -0700
  Re: Any way to do this in JavaScript? kintalken@gmail.com - 2017-05-18 20:13 -0700

csiph-web