Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Dr J R Stockton Newsgroups: comp.lang.javascript Subject: Re: Set some elements of an array Date: Fri, 27 Jan 2012 20:39:32 +0000 Organization: Home Lines: 32 Message-ID: References: <94303e95-1469-4608-b582-33dec96f7e39@p21g2000yqm.googlegroups.com> <1u41i7ttl9evaofuq75ffktd4c9lracvbg@4ax.com> NNTP-Posting-Host: JfH6RRPWQh8XzArFI0xgxA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain;charset=us-ascii X-Complaints-To: abuse@aioe.org User-Agent: Turnpike/6.05-S () X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.javascript:10658 In comp.lang.javascript message <1u41i7ttl9evaofuq75ffktd4c9lracvbg@4ax. com>, Wed, 25 Jan 2012 15:54:35, Gene Wirchenko 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 - w. FAQish topics, links, acronyms PAS EXE etc. : - see in 00index.htm Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.