Page 292 - Web Applications (803) Class 11
P. 292
Do You Know?
The writeln() method works within <PRE> tag.
Lab Assignment ‘n Activity Subject Enrichment
Create a JavaScript program to display the following in different lines:
1. Your name, class, best friend(s)’ names
2. Today’s date and time
3. Your best memory
4.9 JAVASCRIPT DATA TYPES
A data type is a classification of the type of data that can be stored in a variable or object. Variables in JavaScript can
hold a variety of data types, including numbers, strings, objects, and more.
Data Type Description Example
String textual data “What is lovely day”, ‘Pizza’
Number an integer or a floating-point number 6, 6.43
Boolean Can have only true or false or 0 or 1 value true, false
Undefined the variable is not initialized let x;
Null represents no value let x = null;
Object key-value pairs of collection of data let employee = { };
All the above data types except Object are called primitive data types whereas Object is called composite data type.
4.10 STATEMENTS IN JAVASCRIPT
Commands and instructions given to the JavaScript interpreter to take some actions are called statements and a
collection of statements is called a script or a program. Within almost every browser resides the JavaScript interpreter.
We use the semicolon to terminate a statement but, if the statements are written in separate lines, then the semicolon
can be omitted.
290 Touchpad Web Applications-XI

