Tuesday, October 21, 2014

Basics Of Array In Javascript

Array In JavaScript:

  • An array is a special variable, which can hold more than one value, at a time.
  • Each element in the array has its own ID so that it can be easily accessed.
  • It is important to realize that each value is stored in one element of the array and
  • These elements start at 0.

Types Of JavaScript:
1)Basic Array :
        - Basic Array represent one or value separated by commas. 
- The value can be a mixtures of a string, numbers and variables.
- Each array item gets an index number associated with it`s key.
Build a basic array and access its item directly by their index number.
var choice=[“RED”,”Cricket”,”Kal Ho Na Ho”];
document.write(choice[0]+”Is my Favourite Color.<br/>”);
document.write(choice[1]+”Is my Favourite Game.<br/>”);
document.write(choice[2]+”Is my Favourite Movie.<br/>”);

Populate array by placing value directly into  index position of the array.
var game=[];
game[0]=”Cricket”;
game[1]=”Football”;
game[2]=”Chess”;
document.write(game);
                  

2)Associative Array :
        - Associative array give you a way to label your array item key.
- The key is directly associated to its value in a meaningful way.
- Example:

                var arr={name:”KALPESH”, surname=”RAKHOLIYA”,age=22};
document.write(arr[“name”]+”And Surname Is:”+arr[“surname”]+”<br>”);
document.write(arr[“name”]+”And Age Is:”+arr[“age”]+”<br>”);

3)Multidimensional Array :
        - Multidimensional array is an array that holding multiple array that can be of various types.
- Example:
var arr=new Array
(
[“Sachin”,”Sehwag”,”Kohli”],
[“Watson”,”Warner”,”Hussy”],
[“Cook”,”Campton”,”Piterson”]
);
document.write(arr[0]+”<br>”);
document.write(arr[1]+”<br>”);
document.write(arr[2]+”<br>”);


8 comments:

Webtrackker Noida said...

Webtrackker technology is the best IT training institute in NCR. Webtrackker provide training on all latest technology such as Php training. Webtrackker is not only training institute but also it also provide best IT solution to his client. Webtrackker provide training by experienced and working in the industry on same technology.Webtrackker Technology C-67 Sector-63 Noida 8802820025

Php training institute in indirapuram


Php training institute in Noida


Php training institute in Ghaziabad


Php training institute in Vaishali


Php training institute in Vasundhara


Php training institute in Delhi South Ex

Chandran C said...

SMPS problem can also cause to restart your PC. Good post with good details. Post more photos on how to service the smps and also if you can also post a video in the blog. Thanks from a computer and home appliance service person.

Priya Kannan said...

Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
PHP Training in Chennai

lg customer care said...

whirlpool service centre & customer care in delhi,faridabad,noida,gurgaon
whirlpool refrigerator,washing machine,microwave customer care & service centre in delhi,noida,gurgaon,faridabad
Whirlpool Service Center, Whirlpool Customer Care Faridabad, Whirlpool Washing Machine Service Center Noida, Whirlpool Refrigerator Repair Gurgaon, Whirlpool Microwave customer care in Delhi

whirlpool customer care & service centre in delhi,noida,faridabad,gurgaon

lg customer care said...

bosch refrigerator,washing machine,microwave service centre & customer care in delhi,noida,gurgaon,faridabad
bosch customer care & service centre in delhi,noida,gurgaon,faridabad
bosch refrigerator,washing machine,microwave customer care in delhi,noida,gurgaon,faridabad

lg customer care said...

ifb customer care,ifb service centre in delhi,gurgaon,noida,faridabad
ifb refrigerator,washing machine,microwave service centre & customer care in delhi,faridabad,gurgaon,noida
ifb refrigerator,washing machine,microwave in delhi ,faridabad,gurgaon,noida

lg customer care said...

samsung service centre & customer care
samsung service centre & customer care in faridabad,delhi,noida,gurgaon
samsung customer care & service centre in faridabad,samsung customer care & service centre in delhi,samsung customer care & service centre in gugaon,samsung customer care & service centre in noida,samsung customer care in delhi,samsung customer care in faridabad,samsung customer care in gurgaon,samsung customer care in noida

samsung refrigerator customer care in delhi,noida,faridabad,gurgaon
samsung washing machine customer care & service centre in delhi,noida,gurgaon,faridabad
samsung microwave customer care in delhi,noida,gurgaon,faridabad
samsung customer care & service centre in delhi,noida,gurgaon,faridabad

lg customer care said...

lg refrigerator customer care in delhi,noida,gurgaon,faridabad
lg washing machine customer care in delhi,noida,gurgaon,faridabad
lg refrigerator customer care in delhi
lg washing machine customer care in delhi
lg customer care & service centre in delhi,noida,gurgaon,faridabad
lg microwave customer care in delhi,noida,gurgaon,faridabad