473,385 Members | 1,379 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,385 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 8612


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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.