x


Javascript - List

I am trying to find a List like function for Javascript, but to no avail. I need to be able to create a custom list like List. I know you can do it in C# but I need it in Javascript.

Hopefully there is something similar. Thanks

more ▼

asked Sep 12, 2011 at 01:18 AM

BrandonLayton gravatar image

BrandonLayton
1 5 6 8

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first
more ▼

answered Sep 13, 2011 at 10:54 AM

SisterKy gravatar image

SisterKy
3.1k 81 87 117

uh, Unity (or Mono) adds features like those collections to JS? That is crazy, actually

Sep 13, 2011 at 11:51 AM japanitrat

I take that as crazy-in-a-good-way? ^^

Sep 13, 2011 at 11:59 AM SisterKy

indeed ;) but i wonder where this is documented (except for the collections)

Sep 13, 2011 at 12:13 PM japanitrat
(comments are locked)
10|3000 characters needed characters left

If you are speaking of C# then "List" is not a function but a collection. In JS you can use Array which serves the same purpose (for instance you can push and pop elements dynamically), although it does provide the same amount possibilities.

more ▼

answered Sep 12, 2011 at 01:25 AM

japanitrat gravatar image

japanitrat
99 4 5 10

Array is not really what I need. I need something that do the equivalence of List<MyClass>.

Sep 12, 2011 at 09:46 PM BrandonLayton

JavaScript has no generics, so the answer is no. But you can put all kinda things into a JS Array, its just not type-safe.

Edit: as pointed out by Ky, Unity or Mono do enhance the common JS stuff.

Sep 13, 2011 at 09:22 AM japanitrat
(comments are locked)
10|3000 characters needed characters left
more ▼

answered Feb 26, 2013 at 06:04 AM

timrox99 gravatar image

timrox99
3 2

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x6290
x863
x128

asked: Sep 12, 2011 at 01:18 AM

Seen: 40656 times

Last Updated: Feb 26, 2013 at 06:04 AM