0% found this document useful (0 votes)
2 views44 pages

2.2 JavaScript Data Types

The document covers JavaScript fundamentals, focusing on data types such as numbers, booleans, undefined, null, arrays, and objects. It explains type conversions, operators (including arithmetic, string, comparison, logical, bitwise, and type operators), and provides examples of JavaScript code. The content is structured for educational purposes, aimed at teaching the basics of JavaScript programming.

Uploaded by

Karthikeyini S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views44 pages

2.2 JavaScript Data Types

The document covers JavaScript fundamentals, focusing on data types such as numbers, booleans, undefined, null, arrays, and objects. It explains type conversions, operators (including arithmetic, string, comparison, logical, bitwise, and type operators), and provides examples of JavaScript code. The content is structured for educational purposes, aimed at teaching the basics of JavaScript programming.

Uploaded by

Karthikeyini S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

PHP & JS FRAMEWORK 1

20CSI504-PHP & JS FRAMEWORK

Module : II
Module name : JavaScript Fundamentals
Topic : Data Types
Faculty : Dr. S. Karthikeyini, AP/M.Tech CSE
PHP & JS FRAMEWORK 2

DATA TYPES
PHP & JS FRAMEWORK 3

NUMBER
PHP & JS FRAMEWORK 4

BOOLEAN
Any variable can be emptied, by setting the value to undefined. The type will also be undefined
Any variable can be emptied, by setting the value to undefined.
PHPThe type
& JS will also be undefined
FRAMEWORK 5

UNDEFINED
✔In JavaScript, a variable without a value, has the
value undefined. The type is also undefined.
✔Any variable can be emptied, by setting the value
to undefined. The type will also be undefined
PHP & JS FRAMEWORK 6

UNDEFINED
PHP & JS FRAMEWORK 7

NULL
PHP & JS FRAMEWORK 8

ARRAY
PHP & JS FRAMEWORK 9

OBJECT
PHP & JS FRAMEWORK 10

OBJECT
• JavaScript objects are written with curly braces {}.
• Object properties are written as name:value pairs,
separated by commas.
PHP & JS FRAMEWORK 11

TYPE CONVERSIONS-IMPLICIT
PHP & JS FRAMEWORK 12

TYPE CONVERSIONS-EXPLICIT
PHP & JS FRAMEWORK 13

OPERATORS
PHP & JS FRAMEWORK 14

OPERATORS
• JavaScript includes operators same as other languages.
• An operator performs some operation on single or multiple
operands (data value) and produces a result.
• For example, in 1 + 2, the + sign is an operator and 1 is
left side operand and 2 is right side operand.
• The + operator performs the addition of two numeric
values and returns a result.
PHP & JS FRAMEWORK 15

OPERATORS
PHP & JS FRAMEWORK 16

OPERATORS
PHP & JS FRAMEWORK 17

JS OPERATORS-ASSIGNMNET
• The assignment operator (=) assigns a value to a
variable.
PHP & JS FRAMEWORK 18

CONTD..,
PHP & JS FRAMEWORK 19

ARITHMETIC OPERATORS
✔Arithmetic operators are used to perform arithmetic on
numbers
PHP & JS FRAMEWORK 20

EXAMPLE
PHP & JS FRAMEWORK 21

STRING OPERATORS
• The + operator can also be used to add (concatenate)
strings.
PHP & JS FRAMEWORK 22

EXAMPLE
PHP & JS FRAMEWORK 23

COMPARISON OPERATORS
PHP & JS FRAMEWORK 24

EXAMPLE
PHP & JS FRAMEWORK 25

LOGICAL OPERATORS
PHP & JS FRAMEWORK 26

EXAMPLE
PHP & JS FRAMEWORK 27

BITWISE OPERATOR
PHP & JS FRAMEWORK 28

EXAMPLLE
PHP & JS FRAMEWORK 29

TYPE OPERATORS
PHP & JS FRAMEWORK 30

TYPEOF OPERATOR
PHP & JS FRAMEWORK 31

EXAMPLE
32

Example1
<! DOC TYPE html>
<html>
<head>
<title> Java script Practice </title>
<script>
var name = “Java Script”
Var num1=45, num=34.5, subject= “we are learning java script”;
alert(name);
Doument.writeln(num1);
Doument.writeln(num1);
Alert(subject)
</script>
</head>
<body>
<p> This is an example of using declaring variable in Javascript</p>
</body>
</html>
33

Example 2
34

example2
35

example3
36

Example 4
37
38

Example
39
40

example
41

By Literal Objects
42

By Instance of objects
43

By object constructor
44

You might also like