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


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

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 alt.comp.lang.javascript
Subject Any way to do this in JavaScript?
Date Mon, 18 Jul 2016 23:40:17 -0700
Organization A noiseless patient Spider
Lines 19
Message-ID <nmki0q$nl9$1@dont-email.me> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Tue, 19 Jul 2016 06:40:27 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="5b2cab364112ad98b7df59c61a581b22"; logging-data="24233"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+WPQauCm4tNuaChViN5wDi6D/sQVml0JE="
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
X-Mozilla-News-Host news://news.eternal-september.org:119
Cancel-Lock sha1:p2anOShx85LIYt0kyPlJjvqKYOE=
Xref csiph.com alt.comp.lang.javascript:6

Show key headers only | View raw


In Perl, I have:

	my ($title, $chan, $call, $sTime, $dur) = split /~~/, $el;

I've converted this to JavaScript thusly:

	var flds = el.split('~~');	// split into array, then to vars

	var title = flds[0];
	var chan =  flds[1];
	var call =  flds[2];
	var sTime = flds[3];
	var dur =   flds[4];

I was hoping for a more straightforward/cleaner syntax - something like:

	var (title, chan, call, sTime, dur) = el.split('~~'); // do it all in one like Perl

Any way to do that?

Back to alt.comp.lang.javascript | Previous | NextNext 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