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


Groups > comp.lang.javascript > #10658

Re: Set some elements of an array

From Dr J R Stockton <reply1204@merlyn.demon.co.uk>
Newsgroups comp.lang.javascript
Subject Re: Set some elements of an array
Date 2012-01-27 20:39 +0000
Organization Home
Message-ID <xynDFTDEuwIPFwCs@invalid.uk.co.demon.merlyn.invalid> (permalink)
References <94303e95-1469-4608-b582-33dec96f7e39@p21g2000yqm.googlegroups.com> <1u41i7ttl9evaofuq75ffktd4c9lracvbg@4ax.com>

Show all headers | View raw


In comp.lang.javascript message <1u41i7ttl9evaofuq75ffktd4c9lracvbg@4ax.
com>, Wed, 25 Jan 2012 15:54:35, Gene Wirchenko <genew@ocis.net> posted:

>     Try
>
>var b1=[1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0];
>
>or
>
>var b1=[1,2,3,4];
>for (var i=4; i<16; i++)
>  b1[i]=0;

     Try

var b1=[1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0];

or

var b1=[], i=0
do { b1[i] = ++i * (i<5) } while (i < 16)


NOTE - it is well to avoid i & l & o & O for variable identifiers in
News articles, since you know nothing about the monitors, fonts,
spelling-checkers, and eyeballs that your avid readers are using.

-- 
 (c) John Stockton, nr London, UK.    ?@merlyn.demon.co.uk     Turnpike v6.05.
 Website  <http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
 PAS EXE etc. : <http://www.merlyn.demon.co.uk/programs/> - see in 00index.htm
 Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.

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


Thread

Set some elements of an array Archos <raul.san@sent.com> - 2012-01-25 14:05 -0800
  Re: Set some elements of an array "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2012-01-25 16:30 -0800
  Re: Set some elements of an array Gene Wirchenko <genew@ocis.net> - 2012-01-25 15:54 -0800
    Re: Set some elements of an array "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-01-27 09:16 +0000
    Re: Set some elements of an array Dr J R Stockton <reply1204@merlyn.demon.co.uk> - 2012-01-27 20:39 +0000

csiph-web