GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Friday, December 17, 2010

Standard Javascript - Array

Array is the most important one in javascript data structure. It like another array in other programming language, but it has one better characteristics, that is LOSELY DATA STRUCTURE.

There many ways to initialize an array variable:
>> var names = new Array();
>> names[] = "lady gaga";
>> names[] = "luna maya";
>> names[] = "aura kasih";
Or
>> var names = ["lady gaga","luna maya","aura kasih"];

When you need to add an element, you use var name wit bracket but without index number, so the array automatically will sort it based on need. But when you want to access an element in it, you must use index number.

Share/Bookmark

No comments:

Post a Comment