SlideShare uma empresa Scribd logo
1 de 10
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?

Mais conteúdo relacionado

Mais procurados

JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and Functions
Jussi Pohjolainen
 
Javascript operators
Javascript operatorsJavascript operators
Javascript operators
Mohit Rana
 
Data types in php
Data types in phpData types in php
Data types in php
ilakkiya
 

Mais procurados (20)

Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and Functions
 
JavaScript - Chapter 6 - Basic Functions
 JavaScript - Chapter 6 - Basic Functions JavaScript - Chapter 6 - Basic Functions
JavaScript - Chapter 6 - Basic Functions
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
Javascript operators
Javascript operatorsJavascript operators
Javascript operators
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
JavaScript - Chapter 5 - Operators
 JavaScript - Chapter 5 - Operators JavaScript - Chapter 5 - Operators
JavaScript - Chapter 5 - Operators
 
Javascript functions
Javascript functionsJavascript functions
Javascript functions
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
Angularjs PPT
Angularjs PPTAngularjs PPT
Angularjs PPT
 
jQuery
jQueryjQuery
jQuery
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
 
Loops in java script
Loops in java scriptLoops in java script
Loops in java script
 
Dom
DomDom
Dom
 
Data types in php
Data types in phpData types in php
Data types in php
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 

Semelhante a Datatype in JavaScript

Flash workshop Day Three
Flash workshop Day ThreeFlash workshop Day Three
Flash workshop Day Three
Law Chng
 
Ruby data types and objects
Ruby   data types and objectsRuby   data types and objects
Ruby data types and objects
Harkamal Singh
 
what-is-python-presentation.pptx
what-is-python-presentation.pptxwhat-is-python-presentation.pptx
what-is-python-presentation.pptx
Vijay Krishna
 
uom-2552-what-is-python-presentation (1).pptx
uom-2552-what-is-python-presentation (1).pptxuom-2552-what-is-python-presentation (1).pptx
uom-2552-what-is-python-presentation (1).pptx
Prabha Karan
 

Semelhante a Datatype in JavaScript (20)

Swift Tutorial Part 2. The complete guide for Swift programming language
Swift Tutorial Part 2. The complete guide for Swift programming languageSwift Tutorial Part 2. The complete guide for Swift programming language
Swift Tutorial Part 2. The complete guide for Swift programming language
 
Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
 
Swift Tutorial Part 1. The Complete Guide For Swift Programming Language
Swift Tutorial Part 1. The Complete Guide For Swift Programming LanguageSwift Tutorial Part 1. The Complete Guide For Swift Programming Language
Swift Tutorial Part 1. The Complete Guide For Swift Programming Language
 
Flash workshop Day Three
Flash workshop Day ThreeFlash workshop Day Three
Flash workshop Day Three
 
Programming in scala - 1
Programming in scala - 1Programming in scala - 1
Programming in scala - 1
 
Type Checking JavaScript
Type Checking JavaScriptType Checking JavaScript
Type Checking JavaScript
 
Interesting Facts About Javascript
Interesting Facts About JavascriptInteresting Facts About Javascript
Interesting Facts About Javascript
 
Optionals by Matt Faluotico
Optionals by Matt FaluoticoOptionals by Matt Faluotico
Optionals by Matt Faluotico
 
data handling revision.pptx
data handling revision.pptxdata handling revision.pptx
data handling revision.pptx
 
Chapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B KuteChapter 01 Introduction to Java by Tushar B Kute
Chapter 01 Introduction to Java by Tushar B Kute
 
Javascript omg!
Javascript omg!Javascript omg!
Javascript omg!
 
Ruby data types and objects
Ruby   data types and objectsRuby   data types and objects
Ruby data types and objects
 
python-presentation.pptx
python-presentation.pptxpython-presentation.pptx
python-presentation.pptx
 
what-is-python-presentation.pptx
what-is-python-presentation.pptxwhat-is-python-presentation.pptx
what-is-python-presentation.pptx
 
What is Paython.pptx
What is Paython.pptxWhat is Paython.pptx
What is Paython.pptx
 
ScalaTrainings
ScalaTrainingsScalaTrainings
ScalaTrainings
 
Ruby Functional Programming
Ruby Functional ProgrammingRuby Functional Programming
Ruby Functional Programming
 
Review of c_sharp2_features_part_iii
Review of c_sharp2_features_part_iiiReview of c_sharp2_features_part_iii
Review of c_sharp2_features_part_iii
 
uom-2552-what-is-python-presentation.pptx
uom-2552-what-is-python-presentation.pptxuom-2552-what-is-python-presentation.pptx
uom-2552-what-is-python-presentation.pptx
 
uom-2552-what-is-python-presentation (1).pptx
uom-2552-what-is-python-presentation (1).pptxuom-2552-what-is-python-presentation (1).pptx
uom-2552-what-is-python-presentation (1).pptx
 

Último

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Último (20)

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 

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?