‘é >
<=
an
12
tior
Array, Func cee
Se Sete ne ou
| ; : ; co
| ¢ function - Calin 5 : aaion, rea
fing . wCodeAth),
} 0 ipulste a string, Joining a string, retriev a
24 Array
Sapien penal wast Mer sw sore
An array is an object that can store a collection of Items. Arrays is U ot ee wi have to create 300 gal
data of the same type lke storing of details of 100 students. If you a a vay by referring to its des al
Fe aan hs orem ssepe ay rove terri Ta
Numbers, Strings and Boolean ina single eray.
2.1.1 Declaring an Array
There are basically two ways to declare an array
1. By array literal :
syntax :
(7 var areayname= [value valued, sovalueN a
Values are contained inside []and separated by, (comma).
Program 2.1.1 : Write a Javascript code to demonstrate Array Literal
Solution :
[
Stitle> Array Demo
|
EE eeeee on iis |
Array Demo - Intemet Explore?
aD (nl |
th of Array =5 |
|
a |
f 2. By creating instance of Array :
@.__Whatie Aray ? How to create Array in Javascript. ¥
} Syntax
new keyword is used to stance of array
Program 2.1.2 ; Write a Javascript code to create an Array and print its length.
Solution
[enemi> iS "
[
| Array Demo
extjavascript”>
|.
[
| Array Demo
|
= "Javascript" type="text/javascript" >
|Sbody>
{
j