SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
Couple-O-Points
● JavaScript is a “loosely typed” or “dynamic”
language.
● So we don’t have to declare type of a variable
ahead of time.
● You can check the type of any variable using
‘typeof’ operator
Data Types in JavaScript
● Numbers
● Strings
● Boolean
● Objects
● Undefined
● Null
Numbers
● JavaScript has single number type
● It is represented as 64-bit floating point
● No separate type of Integer (like Java etc.)
● 2e3 means 2000 i.e 2 multiplied by 10 raised to the power
after ‘e’ symbol.
● In addition, Number type also has three symbolic values
– Infinity
– -Infinity
– NaN
Strings
● Set of “elements” of 16-bit unsigned integer values.
● Each element in the String occupies a position in String
● Strings are immutable
● Strings have methods, useful ones, like:
– length()
– ToUpperCase()
● New strings can be made using concatenation (‘+’)
operator. Interesting case:
– ‘r’ + ‘a’ + ‘j’ === ‘raj’
Boolean
● Represents logical entity
● Can have two values
– true
– false
Objects
● Objects are collection of properties
● Properties can be removed and added, after
object has been created
● Object is a mapping between keys and values
– A key value is either a symbol or string value
– Values can be of any type i.e Number,
Boolean, Object etc
● Objects are mutable.
Undefined
● It’s a property of global object
● A variable that has not been assigned a value is
of type undefined.
● A function returns undefined if a value was not
returned.
Null
● Represents absence of any object value
● Operation “typeof null” yields “object”
Exercise
● What are the differences between “null” and
“undefined”?
● How would you test that a variable is defined
and has a non-null value?
Exercise
● What are the differences between “null” and
“undefined”?
● How would you test that a variable is defined
and has a non-null value?

More Related Content

PDF
Fundamental JavaScript [UTC, March 2014]
Aaron Gustafson
 
PPTX
Java script
Prarthan P
 
PDF
3. Java Script
Jalpesh Vasa
 
PPTX
JavaScript New Tutorial Class XI and XII.pptx
rish15r890
 
PDF
javascript objects
Vijay Kalyan
 
PPTX
Javascript functions
Alaref Abushaala
 
PDF
Javascript essentials
Bedis ElAchèche
 
PPTX
JavaScript.pptx
KennyPratheepKumar
 
Fundamental JavaScript [UTC, March 2014]
Aaron Gustafson
 
Java script
Prarthan P
 
3. Java Script
Jalpesh Vasa
 
JavaScript New Tutorial Class XI and XII.pptx
rish15r890
 
javascript objects
Vijay Kalyan
 
Javascript functions
Alaref Abushaala
 
Javascript essentials
Bedis ElAchèche
 
JavaScript.pptx
KennyPratheepKumar
 

What's hot (20)

PPSX
Javascript variables and datatypes
Varun C M
 
PPT
PHP - Introduction to Object Oriented Programming with PHP
Vibrant Technologies & Computers
 
PDF
JavaScript - Chapter 6 - Basic Functions
WebStackAcademy
 
PDF
Basics of JavaScript
Bala Narayanan
 
PDF
JavaScript - Chapter 8 - Objects
WebStackAcademy
 
PDF
Javascript basics
shreesenthil
 
PPTX
Java script
Shyam Khant
 
PPT
Javascript
guest03a6e6
 
PDF
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
PPT
Js ppt
Rakhi Thota
 
PPTX
Exception handling
PhD Research Scholar
 
PPTX
Java script
Sadeek Mohammed
 
PDF
JavaScript - Chapter 5 - Operators
WebStackAcademy
 
PPTX
Java Datatypes
Mayank Aggarwal
 
PDF
Regular expression in javascript
Toan Nguyen
 
PPTX
Java Data Types
Spotle.ai
 
PPT
Introduction to Javascript
Amit Tyagi
 
PPTX
Python OOPs
Binay Kumar Ray
 
PPTX
Php basics
Jamshid Hashimi
 
Javascript variables and datatypes
Varun C M
 
PHP - Introduction to Object Oriented Programming with PHP
Vibrant Technologies & Computers
 
JavaScript - Chapter 6 - Basic Functions
WebStackAcademy
 
Basics of JavaScript
Bala Narayanan
 
JavaScript - Chapter 8 - Objects
WebStackAcademy
 
Javascript basics
shreesenthil
 
Java script
Shyam Khant
 
Javascript
guest03a6e6
 
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Js ppt
Rakhi Thota
 
Exception handling
PhD Research Scholar
 
Java script
Sadeek Mohammed
 
JavaScript - Chapter 5 - Operators
WebStackAcademy
 
Java Datatypes
Mayank Aggarwal
 
Regular expression in javascript
Toan Nguyen
 
Java Data Types
Spotle.ai
 
Introduction to Javascript
Amit Tyagi
 
Python OOPs
Binay Kumar Ray
 
Php basics
Jamshid Hashimi
 
Ad

Similar to Datatype in JavaScript (20)

PPTX
Chapter 1 .pptx
MohamedAbdullahiYusu
 
PPT
JavaScript Data Types
Charles Russell
 
PPT
An introduction to javascript
MD Sayem Ahmed
 
PDF
Introduction to Javascript and Typescript.pdf
rony setyawansyah
 
PDF
02 JavaScript Syntax
Ynon Perek
 
PPTX
Javascript analysis
Uchitha Bandara
 
PPT
Javascript
Manav Prasad
 
PPTX
Javascript
Prashant Kumar
 
PDF
Java script summary
maamir farooq
 
PDF
Js ch-1
Saritapol13
 
PPT
Java Script Introduction
jason hu 金良胡
 
PPTX
Front end fundamentals session 1: javascript core
Web Zhao
 
PPT
02. Data Type and Variables
Tommy Vercety
 
PPT
data-types-operators-datatypes-operators.ppt
Gagan Rana
 
PDF
TYPESCRIPT.pdfgshshhsjajajsjsjjsjajajjajjj
sonidsxyz02
 
PPTX
WT Unit-3 PPT.pptx
TusharTikia
 
PDF
Type Checking JavaScript
Pascal-Louis Perez
 
PDF
javascript teach
guest3732fa
 
PDF
JSBootcamp_White
guest3732fa
 
PPT
13665449.ppt
JP Chicano
 
Chapter 1 .pptx
MohamedAbdullahiYusu
 
JavaScript Data Types
Charles Russell
 
An introduction to javascript
MD Sayem Ahmed
 
Introduction to Javascript and Typescript.pdf
rony setyawansyah
 
02 JavaScript Syntax
Ynon Perek
 
Javascript analysis
Uchitha Bandara
 
Javascript
Manav Prasad
 
Javascript
Prashant Kumar
 
Java script summary
maamir farooq
 
Js ch-1
Saritapol13
 
Java Script Introduction
jason hu 金良胡
 
Front end fundamentals session 1: javascript core
Web Zhao
 
02. Data Type and Variables
Tommy Vercety
 
data-types-operators-datatypes-operators.ppt
Gagan Rana
 
TYPESCRIPT.pdfgshshhsjajajsjsjjsjajajjajjj
sonidsxyz02
 
WT Unit-3 PPT.pptx
TusharTikia
 
Type Checking JavaScript
Pascal-Louis Perez
 
javascript teach
guest3732fa
 
JSBootcamp_White
guest3732fa
 
13665449.ppt
JP Chicano
 
Ad

Recently uploaded (20)

PPTX
Autodock-for-Beginners by Rahul D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
PDF
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
PPTX
FSSAI (Food Safety and Standards Authority of India) & FDA (Food and Drug Adm...
Dr. Paindla Jyothirmai
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PDF
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
CDH. pptx
AneetaSharma15
 
PPTX
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
PDF
UTS Health Student Promotional Representative_Position Description.pdf
Faculty of Health, University of Technology Sydney
 
PDF
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PDF
Study Material and notes for Women Empowerment
ComputerScienceSACWC
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PPTX
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
Autodock-for-Beginners by Rahul D Jawarkar.pptx
Rahul Jawarkar
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
FSSAI (Food Safety and Standards Authority of India) & FDA (Food and Drug Adm...
Dr. Paindla Jyothirmai
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
CDH. pptx
AneetaSharma15
 
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
UTS Health Student Promotional Representative_Position Description.pdf
Faculty of Health, University of Technology Sydney
 
RA 12028_ARAL_Orientation_Day-2-Sessions_v2.pdf
Seven De Los Reyes
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Study Material and notes for Women Empowerment
ComputerScienceSACWC
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 

Datatype in JavaScript

  • 1. Couple-O-Points ● JavaScript is a “loosely typed” or “dynamic” language. ● So we don’t have to declare type of a variable ahead of time. ● You can check the type of any variable using ‘typeof’ operator
  • 2. Data Types in JavaScript ● Numbers ● Strings ● Boolean ● Objects ● Undefined ● Null
  • 3. Numbers ● JavaScript has single number type ● It is represented as 64-bit floating point ● No separate type of Integer (like Java etc.) ● 2e3 means 2000 i.e 2 multiplied by 10 raised to the power after ‘e’ symbol. ● In addition, Number type also has three symbolic values – Infinity – -Infinity – NaN
  • 4. Strings ● Set of “elements” of 16-bit unsigned integer values. ● Each element in the String occupies a position in String ● Strings are immutable ● Strings have methods, useful ones, like: – length() – ToUpperCase() ● New strings can be made using concatenation (‘+’) operator. Interesting case: – ‘r’ + ‘a’ + ‘j’ === ‘raj’
  • 5. Boolean ● Represents logical entity ● Can have two values – true – false
  • 6. Objects ● Objects are collection of properties ● Properties can be removed and added, after object has been created ● Object is a mapping between keys and values – A key value is either a symbol or string value – Values can be of any type i.e Number, Boolean, Object etc ● Objects are mutable.
  • 7. Undefined ● It’s a property of global object ● A variable that has not been assigned a value is of type undefined. ● A function returns undefined if a value was not returned.
  • 8. Null ● Represents absence of any object value ● Operation “typeof null” yields “object”
  • 9. Exercise ● What are the differences between “null” and “undefined”? ● How would you test that a variable is defined and has a non-null value?
  • 10. Exercise ● What are the differences between “null” and “undefined”? ● How would you test that a variable is defined and has a non-null value?