Forum Moderators: open

Message Too Old, No Replies

Max Characters to be stored in a Variable

newbie question, please help...

         

camilord

2:15 pm on Jun 18, 2007 (gmt 0)

10+ Year Member



for example i declare a variable...

=====================================
var msgs = '';
=====================================

now, i will put 12,000 characters in that variable... can it be handle?

what is the maximum characters or bytes can a variable of a javascript can be handle?

please answer.. thanks...

Bernard Marx

4:03 pm on Jun 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think there is any official limit (although the largest representable integer in length may be one).

12,000 chars length should be no problem...


n = 100000;
a = "0123456789";
b = "";
m = Math.floor(n/a.length);

while(m--) b+=a;

alert(b.length)