Re: best way to load arrays with large amounts of data?



Marshal Anderson wrote:
I'm working on an application that requires a lot of internal data -
short texts, numbers, switches etc. At the moment the only way I have of
loading these is long lines of Array[1,2,3 etc]=The Data.

No, certainly you don't. However, you may have something like

var a = new Array();
a[0] = ...;
a[1] = ...;

In the VB version I read data in from text files - is there a similar
feature in JavaScript -

Reading files or rather accessing resources is not a feature of the
language, but a feature of an API that can be used by the language.

As for reading text files/resources, you can load the file per URI in an
iframe and read its contents using the DOM, or you can use the
IXMLHTTPRequest interface to make a request and retrieve the response text.

http://en.wikipedia.org/wiki/Document_Object_Model
http://en.wikipedia.org/wiki/AJAX

or at least soem thing mroe flaxible than lines and lines of assignments?

var a1 = new Array(
...,
...
);

Since JavaScript 1.3:

var a2 = [
...,
...
];


PointedEars
.



Relevant Pages

  • Re: I freaking HATE var!!
    ... You can eschew var, as well as extension methods, and the syntax that translates queries from the C# 3.0 language and actually chain the static method calls yourself, passing anonymous delegates and known types as the return. ... There are ALWAYS going to be new technologies that are coming out and you, being a professional in the field, will have to decide on how you want to leverage those technologies in what you do to provide for how you make a living. ... What I'm getting at is, if 'var' is the necessity of a new feature, my hatred of 'var' is greater than that feature. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: I freaking HATE var!!
    ... of other 3.0 features than what var uses, ... the syntax that translates queries from the C# 3.0 language and actually ... There are ALWAYS going to be new technologies that are coming out ... greater than that feature. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: I freaking HATE var!!
    ... other 3.0 features than what var uses, ... the syntax that translates queries from the C# 3.0 language and actually ... There are ALWAYS going to be new technologies that are coming out and you, ... 'var' is the necessity of a new feature, my hatred of 'var' is greater ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Relative merits of Lisp-1 vs. Lisp-2?
    ... If reading data that might be ill-formed, defining your language to ... to dismiss my concern about this issue as irrelevant and unimportant, ... This argument would apply to *any* proposed new feature, ... incompatibilities were simply the result of someone doing something ...
    (comp.lang.lisp)
  • Re: Graphic GUI C
    ... features in C99) is also a feature of C++. ... expect the C language and the C standard library to do everything; ... nothing is more commonplace than the need for one or more libraries in ... The same is true inside of WSH where all of the functionality ...
    (comp.lang.c)