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


Groups > comp.lang.javascript > #12333

Re: Empty array

Path csiph.com!aioe.org!.POSTED!not-for-mail
From Dr J R Stockton <reply1209@merlyn.demon.co.uk>
Newsgroups comp.lang.javascript
Subject Re: Empty array
Date Thu, 1 Mar 2012 21:20:25 +0000
Organization Home
Lines 31
Message-ID <pvrVCIOZg+TPFw4Y@invalid.uk.co.demon.merlyn.invalid> (permalink)
References <0f481e7c-97b9-4c76-9660-321681876658@w9g2000vbv.googlegroups.com> <e8bddc62-6b7f-4463-b0bb-51912eeca4ef@z31g2000vbt.googlegroups.com> <CESvYCJ95UTPFw+M@invalid.uk.co.demon.merlyn.invalid> <opuqk7hsm5bkmp0b14shc14vmv3di8honh@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 (<hY+ExRCkcsssDA9uJ+0bCn8+UA>)
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.lang.javascript:12333

Show key headers only | View raw


In comp.lang.javascript message <opuqk7hsm5bkmp0b14shc14vmv3di8honh@4ax.
com>, Tue, 28 Feb 2012 17:20:30, Gene Wirchenko <genew@ocis.net> posted:

>
>     You could join the array and check against an empty string, but
>that could be expensive with a large array.

And expensive code is particularly bad value if it does not work.

In current Firefox :
        A = []
        A[4.67] = 66
        A.length          // 0
        A.join()          // blank
        A.join().length   // 0
        A[467/100]        // 66

When testing for emptiness, the first thing to do is to define the sort
of item that one wants to test for the absence of.

My favourite tea-cup might be considered to be empty - it is upside-
down.  But it is almost full of air.  It also contains about half a
milk-bottle, itself empty - of milk but not of air.  The air itself is
almost empty; only about 0.1% of it is atoms.  The atoms are even
emptier.

-- 
 (c) John Stockton, nr London UK.  ?@merlyn.demon.co.uk  DOS 3.3 6.20 ; WinXP.
   Web  <http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
   PAS EXE TXT ZIP via  <http://www.merlyn.demon.co.uk/programs/00index.htm>
   My DOS  <http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.

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


Thread

Empty array Archos <raul.san@sent.com> - 2012-02-25 10:21 -0800
  Re: Empty array Gregor Kofler <usenet@gregorkofler.com> - 2012-02-25 23:02 +0100
  Re: Empty array Dr J R Stockton <reply1208@merlyn.demon.co.uk> - 2012-02-26 20:50 +0000
    Re: Empty array "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-02-27 14:46 +0000
      Re: Empty array Dr J R Stockton <reply1209@merlyn.demon.co.uk> - 2012-02-28 23:42 +0000
  Re: Empty array Asen Bozhilov <asen.bozhilov@gmail.com> - 2012-02-27 07:30 -0800
    Re: Empty array Dr J R Stockton <reply1209@merlyn.demon.co.uk> - 2012-02-28 22:00 +0000
      Re: Empty array Gene Wirchenko <genew@ocis.net> - 2012-02-28 17:20 -0800
        Re: Empty array Asen Bozhilov <asen.bozhilov@gmail.com> - 2012-02-29 01:23 -0800
          Re: Empty array Gene Wirchenko <genew@ocis.net> - 2012-02-29 14:12 -0800
        Re: Empty array Dr J R Stockton <reply1209@merlyn.demon.co.uk> - 2012-03-01 21:20 +0000

csiph-web