PGDEL/DECP03/Unit3/17

From WikiEducator
< PGDEL‎ | DECP03‎ | Unit3
Jump to: navigation, search



Unit 3.3 Web application development tools & Technologies
Data Types

The primitive data types that JavaScript supports are:

Data Type
Description
Example
Number
Consists of Integer and floating point numbers
123, -35.89
Boolean
Consists of logical value i.e. true or false
1 for true and 0 for false
String
A string is sequence of characters that are enclosed into double or single quotes
“Rajendra”, ‘Shastri Nagar, Lane 4’
Null
Consisting a single value null, which defines a empty or nonexistent reference

The Complex data type that JavaScript supports is:
Array: Array is cable of storing a sequence of values. Array values are stored in index and individual elements of an array are accessed by using these index.

Syntax:

arrayName= new Array(Array length)
arrayName= new Array( )

Examlple:
Books=new Array[3];
Books[0]=”HTML”;
Books[1]=”XML”;
Books[2]=”JAVASCRIPT”;

Array size can be extended further if more elements are to be inserted, by inserting element in the next index.
The values assigned to the array has no restriction, it could be of different types.

Road Works.svg Work in progress, expect frequent changes. Help and feedback is welcome. See discussion page. Road Works.svg