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>”);


2 comments:

Unknown 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.