473,406 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Maximum number of items in Javascript array

Does anyone know what the maximum number of items (or characters) allowed
is, in a javascript array?

Luke
(I also posted this in alt.www.webmaster so sorry for the duplication)
Jul 23 '05 #1
4 8613


Luke wrote:
Does anyone know what the maximum number of items (or characters) allowed
is, in a javascript array?


An array in JavaScript can have 0..(2^32-1) elements. 2^32-1 is
4,294,967,295.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #2
> An array in JavaScript can have 0..(2^32-1) elements. 2^32-1 is
4,294,967,295.


The array I am using is as follows:

new Array( GetMil(new Date(1992,04,05)), GetMil(new Date(1992,08,22)),
GetMil(new Date(1992,09,16)) etc. which is a set of these date functions and
about 1300 characters

It uses 44 new Date() functions and it had stopped working, however when I
change the dates to 92 instead if 1992 to reduce the number of characters it
starts working again.

Anyone else got any ideas?

Jul 23 '05 #3
Luke wrote:
An array in JavaScript can have 0..(2^32-1) elements. 2^32-1 is
4,294,967,295.

The array I am using is as follows:

new Array( GetMil(new Date(1992,04,05)), GetMil(new Date(1992,08,22)),
GetMil(new Date(1992,09,16)) etc. which is a set of these date functions and
about 1300 characters

It uses 44 new Date() functions and it had stopped working, however when I
change the dates to 92 instead if 1992 to reduce the number of characters it
starts working again.

Anyone else got any ideas?


I have had, in the past, an array that had 34,000+ entries, each being
approximately 80 characters in length. Javascript had no problems with
it. In fact, PHP had more trouble with it than JS did.

First, define "stopped working". Does it not do what it should, does it
crash the browser, lock up the browser, just hang, or what?

What does the GetMil function do? It could very well be that with the
added overhead, it becomes too many things for the browser to handle
(due to overload, RAM, etc...) and it stops execution.

To find out if its the GetMil function, hard code the 44 entries and
work your way backwards until you find the culprit.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 23 '05 #4
"Luke" <gr******@hotmail.com> writes:
The array I am using is as follows:

new Array( GetMil(new Date(1992,04,05)), GetMil(new Date(1992,08,22)),
GetMil(new Date(1992,09,16)) etc. which is a set of these date functions and
about 1300 characters

It uses 44 new Date() functions and it had stopped working, however when I
change the dates to 92 instead if 1992 to reduce the number of characters it
starts working again.


That suggests that the problem is not the number of entries in the array,
but the length of the expression.
Are all dates on the same line (that is, a 1300 char line)? If so, try
breaking it up on several lines.

Otherwise, if there is any system to the dates, you can create the array
programmatically with a loop.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: chirs | last post by:
Hi, What is the maximum number in JavaScript? I tried a large number like 0xff...ff with 30 fs, it still gives me a number, not an infinity. I use IE6. Thanks.
8
by: Hal Vaughan | last post by:
Is there a maximum length for Javascript program lines? What about strings? Is there a limit on string length? I found some references that said the maximum string length was 256 characters,...
9
by: David | last post by:
Hi all, I have an array of strings. For example... = "entry1 first entry"; = "entry2 second entry"; = "entry3 third entry"; etc... How can I sort this array by the number after "entry"?
11
by: Walter Dnes (delete the 'z' to get my real address | last post by:
I've noticed a few threads (full of sound and fury, signifying nothing) here recently about allocation of large memory blocks. I'm about to start on a personal pet project where I'll be using...
20
by: William Stacey [MVP] | last post by:
int list = {1,2,3,4,5,6}; Function to randomize the list? Cheers! -- William Stacey, MVP
2
by: Dean Slindee | last post by:
Is there a maximum number of menu items that can be added to a single form? If there is no maximum, that would help eliminate one possible source of the problem. I had six main menu items in the...
3
by: Kriston-Vizi Janos | last post by:
Dear Mr. Kern, and Members, Thank you very much for the fast answer, my question became over-simplified. My source code is appended below. It uses two text files (L.txt and GC.txt) as input...
2
by: ArtOfSpeech | last post by:
hi.... Can anyone tell me plz how to set a maximum number of (lines) to a rich text control and show only last linse when number of lines exceeds the maximum number??? i've tried to use...
18
by: raylopez99 | last post by:
The maximum int for an array on my machine (a Pentium IV with 2 GB RAM) is < 330 Million...before you get an "out of memory" exception. I simply filled an array of this size with ints...I got as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.