SlideShare a Scribd company logo
1 of 19
JavaScript
Data Types (part
1)
Charles Russell
Bennu Bird Media
JavaScript is a Typed
language
●
Weakly typed does not mean type unaware
●
There are 6 types in JavaScript
●
Boolean
●
Number
●
String
●
Null
●
Undefined
●
Object
– Complex Data type
– Array
typeof Operator
Type val Returns
Undefined 'undefined'
Null 'object'
Boolean 'boolean'
Number 'number'
String 'string'
Object (native and does not implement
[[Call]])
'object'
Object (native or host and does implement
[[Call]])
'function'
Object (host and does not implement [[Call]]) Implementation-defined except may not be
"undefined", "boolean", "number", or "string".
ECMA 262 Table 20
typeof val
But Null is not an object
●
In chapter 8 of the standard Null is declared to be
a primitive type.
●
typeof returns object on null because the standard
says to
●
The only short justification I have seen is from Kiro
Risk
– The reasoning behind this is that null, in contrast with
undefined, was (and still is) often used where objects
appear. In other words, null is often used to signify an empty
reference to an object. When Brendan Eich created
JavaScript, he followed the same paradigm, and it made
sense (arguably) to return "object". In fact, the ECMAScript
specification defines null as the primitive value that
Null
●
As just discussed this is the intentional absence of
any value .
●
Has only one value null
●
Any variable that is set to null is not undefined
●
It just has no value
Undefined defined
●
The Undefined type has exactly one value, called
undefined. Any variable that has not been
assigned a value has the value undefined. ECMA
262 5.1
Objects an introduction
●
Everything that is not a primitive type a is an
object type (remember this it is important later)
●
Properties are charcteristics
●
Methods are actions
●
In JavaScript unlike other languages, objects are
dynamic
●
They can be changed modified and extended at
runtime
●
They can have any value except undefined
●
Represented as name value pairs in code
Boolean
●
Can have one of two values
●
true
●
false
●
Boolean()
●
methods
– toString()
– valueOf()
●
Falsey
– Values that when checked evaluate to false
●
0 or -0
●
EmptyString ""
Next Data Types (part 2)
Number
●
Represented internally as a floating point
●
This has some implications.
– Decimals values are approximations
– 0.1 + 0.2
●
Expected Value 0.3
●
Returned value 0.30000000000000004
– Problem not unique to JavaScript
●
All languages that impliment floating point have the issue
●
Technical reason at The reason in detail is at
http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
for those with a technical or mathematical disposition.
●
When dealing with money covert to cents do the math then convert
back
Number (cont)
●
NaN
●
NaN stands for Not a Number
– But it is if typeof reports it as a Number
– This is the result of bad calculation such as division by 0
– NaN is not equal to anything even NaN
– Any calculations with NaN results in NaN
●
IsNaN() will check to see if a value is NaN
●
Number()
●
toExponential()
●
toFixed()
●
toPrecision()
Number(yes a little more)
●
parseInt(value, radix)
●
Another way to convert a string to a number
●
Radix
– Base 10 the number system we all use is not the only one
●
Octal base 8
– 8 digits 0...7
– 10 = 8, 11=9, 12=10, ….
●
Hexadecimal Base 16
– 15 digits 0..9 then A..F
– A = 10, B = 11, … F=15, 10=16, 11=17, ….
– Leading with 0 makes value ocal, 0x hexadecimal
– Older browsers the value defaulted to octal so use the radix
can be value 1..32 10 would be the radix that we Humans
like the best
The Math Object
●
The Math Object is automatically created and is
globally available
●
Methods include
●
floor()
●
round()
●
sin()
●
cos()
●
tan()
●
random()
●
And many more
Strings
●
0 or more characters represented as two hex
digits
●
UTF-16, for older browsers UCS2
●
There is no char data type as in other languages
●
Here the equivilent is a string of length 1
●
Empty string
●
X=““ is a string of length 0 in other words typeof
returns string
Strings(cont)
●
String literals
●
Are surrounded by Double " or single quotes '
●
Quotes can not be nested in quotes of the same type
– 'this will "work" fine'
– 'this will 'not work' at all'
●
toString()
●
Available on most wrapper type converts values to
their string equivalents
●
Can't handle null or undefined
Strings (yea theres more)
●
Escape characters
●
 allows you to use some special characters
– ' allows you to use ' inside of a single quoted string
– “ allows you to use double quotes in a double quoted string
– n newline
– t tab
–  backslash (escaping the escape)
Some String Properties
and Methods
●
String()
●
length
●
substr()
●
toLowerCase()
●
toUpperCase()
●
split()
●
splice()
Summary
●
JavaScript primatives are Null, Undefined,
Boolean, Number, String and Object
●
The typeof operator can tell you the object type of
a variable
●
There are wrapper Objects for most primatives
●
These wrapper object have useful methods
●
Most things in JavaScript are objects
Next: A Demo and then Operators

More Related Content

What's hot

Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
Varun C M
 
Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced Javascript
Adieu
 

What's hot (20)

Functions in javascript
Functions in javascriptFunctions in javascript
Functions in javascript
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
 
JavaScript - Chapter 6 - Basic Functions
 JavaScript - Chapter 6 - Basic Functions JavaScript - Chapter 6 - Basic Functions
JavaScript - Chapter 6 - Basic Functions
 
9. ES6 | Let And Const | TypeScript | JavaScript
9. ES6 | Let And Const | TypeScript | JavaScript9. ES6 | Let And Const | TypeScript | JavaScript
9. ES6 | Let And Const | TypeScript | JavaScript
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Basic concept of OOP's
Basic concept of OOP'sBasic concept of OOP's
Basic concept of OOP's
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
 
Object Oriented Programming In JavaScript
Object Oriented Programming In JavaScriptObject Oriented Programming In JavaScript
Object Oriented Programming In JavaScript
 
Js ppt
Js pptJs ppt
Js ppt
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
 
Javascript basics
Javascript basicsJavascript basics
Javascript basics
 
Javascript
JavascriptJavascript
Javascript
 
Methods in Java
Methods in JavaMethods in Java
Methods in Java
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVA
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
JavaScript Objects
JavaScript ObjectsJavaScript Objects
JavaScript Objects
 
Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced Javascript
 
JavaScript Conditional Statements
JavaScript Conditional StatementsJavaScript Conditional Statements
JavaScript Conditional Statements
 

Similar to JavaScript Data Types

JavaScript: Patterns, Part 2
JavaScript: Patterns, Part  2JavaScript: Patterns, Part  2
JavaScript: Patterns, Part 2
Chris Farrell
 
JavaScript blast
JavaScript blastJavaScript blast
JavaScript blast
dominion
 
Introduction of python Introduction of python Introduction of python
Introduction of python Introduction of python Introduction of pythonIntroduction of python Introduction of python Introduction of python
Introduction of python Introduction of python Introduction of python
GandaraEyao
 
Data Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docxData Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docx
theodorelove43763
 

Similar to JavaScript Data Types (20)

Programming in scala - 1
Programming in scala - 1Programming in scala - 1
Programming in scala - 1
 
Optionals by Matt Faluotico
Optionals by Matt FaluoticoOptionals by Matt Faluotico
Optionals by Matt Faluotico
 
Clojure Small Intro
Clojure Small IntroClojure Small Intro
Clojure Small Intro
 
Dart workshop
Dart workshopDart workshop
Dart workshop
 
Functional Programming - Worth the Effort
Functional Programming - Worth the EffortFunctional Programming - Worth the Effort
Functional Programming - Worth the Effort
 
JavaScript: Patterns, Part 2
JavaScript: Patterns, Part  2JavaScript: Patterns, Part  2
JavaScript: Patterns, Part 2
 
Smalltalk, the dynamic language
Smalltalk, the dynamic languageSmalltalk, the dynamic language
Smalltalk, the dynamic language
 
Python Essentials - PICT.pdf
Python Essentials - PICT.pdfPython Essentials - PICT.pdf
Python Essentials - PICT.pdf
 
JavaScript blast
JavaScript blastJavaScript blast
JavaScript blast
 
Cs3430 lecture 15
Cs3430 lecture 15Cs3430 lecture 15
Cs3430 lecture 15
 
Software Developer Training
Software Developer TrainingSoftware Developer Training
Software Developer Training
 
Python internals and how they affect your code - kasra ahmadvand
Python internals and how they affect your code - kasra ahmadvandPython internals and how they affect your code - kasra ahmadvand
Python internals and how they affect your code - kasra ahmadvand
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
Kotlin workshop 2018-06-11
Kotlin workshop 2018-06-11Kotlin workshop 2018-06-11
Kotlin workshop 2018-06-11
 
Introduction of python Introduction of python Introduction of python
Introduction of python Introduction of python Introduction of pythonIntroduction of python Introduction of python Introduction of python
Introduction of python Introduction of python Introduction of python
 
Chapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingChapter 2: Elementary Programming
Chapter 2: Elementary Programming
 
Data Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docxData Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docx
 
fundamentals of c
fundamentals of cfundamentals of c
fundamentals of c
 
Java Tutorial Lab 2
Java Tutorial Lab 2Java Tutorial Lab 2
Java Tutorial Lab 2
 
Basics of Javascript
Basics of JavascriptBasics of Javascript
Basics of Javascript
 

More from Charles Russell

More from Charles Russell (10)

Js objects
Js objectsJs objects
Js objects
 
JavaScript Introductin to Functions
JavaScript Introductin to FunctionsJavaScript Introductin to Functions
JavaScript Introductin to Functions
 
JavaScript iteration
JavaScript iterationJavaScript iteration
JavaScript iteration
 
Open Source Software
Open Source SoftwareOpen Source Software
Open Source Software
 
JavaScript Variables
JavaScript VariablesJavaScript Variables
JavaScript Variables
 
JavaScript Tools and Implementation
JavaScript Tools and ImplementationJavaScript Tools and Implementation
JavaScript Tools and Implementation
 
JavaScript Operators
JavaScript OperatorsJavaScript Operators
JavaScript Operators
 
JavaScript Comments and Conditionals
JavaScript Comments and ConditionalsJavaScript Comments and Conditionals
JavaScript Comments and Conditionals
 
JavaScript Introduction
JavaScript IntroductionJavaScript Introduction
JavaScript Introduction
 
Extending drupal authentication
Extending drupal authenticationExtending drupal authentication
Extending drupal authentication
 

Recently uploaded

Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Monica Sydney
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
ayvbos
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
ydyuyu
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
ydyuyu
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
ayvbos
 

Recently uploaded (20)

Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girls
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
 
Local Call Girls in Seoni 9332606886 HOT & SEXY Models beautiful and charmin...
Local Call Girls in Seoni  9332606886 HOT & SEXY Models beautiful and charmin...Local Call Girls in Seoni  9332606886 HOT & SEXY Models beautiful and charmin...
Local Call Girls in Seoni 9332606886 HOT & SEXY Models beautiful and charmin...
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 

JavaScript Data Types

  • 1. JavaScript Data Types (part 1) Charles Russell Bennu Bird Media
  • 2. JavaScript is a Typed language ● Weakly typed does not mean type unaware ● There are 6 types in JavaScript ● Boolean ● Number ● String ● Null ● Undefined ● Object – Complex Data type – Array
  • 3. typeof Operator Type val Returns Undefined 'undefined' Null 'object' Boolean 'boolean' Number 'number' String 'string' Object (native and does not implement [[Call]]) 'object' Object (native or host and does implement [[Call]]) 'function' Object (host and does not implement [[Call]]) Implementation-defined except may not be "undefined", "boolean", "number", or "string". ECMA 262 Table 20 typeof val
  • 4. But Null is not an object ● In chapter 8 of the standard Null is declared to be a primitive type. ● typeof returns object on null because the standard says to ● The only short justification I have seen is from Kiro Risk – The reasoning behind this is that null, in contrast with undefined, was (and still is) often used where objects appear. In other words, null is often used to signify an empty reference to an object. When Brendan Eich created JavaScript, he followed the same paradigm, and it made sense (arguably) to return "object". In fact, the ECMAScript specification defines null as the primitive value that
  • 5. Null ● As just discussed this is the intentional absence of any value . ● Has only one value null ● Any variable that is set to null is not undefined ● It just has no value
  • 6. Undefined defined ● The Undefined type has exactly one value, called undefined. Any variable that has not been assigned a value has the value undefined. ECMA 262 5.1
  • 7. Objects an introduction ● Everything that is not a primitive type a is an object type (remember this it is important later) ● Properties are charcteristics ● Methods are actions ● In JavaScript unlike other languages, objects are dynamic ● They can be changed modified and extended at runtime ● They can have any value except undefined ● Represented as name value pairs in code
  • 8. Boolean ● Can have one of two values ● true ● false ● Boolean() ● methods – toString() – valueOf() ● Falsey – Values that when checked evaluate to false ● 0 or -0 ● EmptyString ""
  • 9. Next Data Types (part 2)
  • 10. Number ● Represented internally as a floating point ● This has some implications. – Decimals values are approximations – 0.1 + 0.2 ● Expected Value 0.3 ● Returned value 0.30000000000000004 – Problem not unique to JavaScript ● All languages that impliment floating point have the issue ● Technical reason at The reason in detail is at http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html for those with a technical or mathematical disposition. ● When dealing with money covert to cents do the math then convert back
  • 11. Number (cont) ● NaN ● NaN stands for Not a Number – But it is if typeof reports it as a Number – This is the result of bad calculation such as division by 0 – NaN is not equal to anything even NaN – Any calculations with NaN results in NaN ● IsNaN() will check to see if a value is NaN ● Number() ● toExponential() ● toFixed() ● toPrecision()
  • 12. Number(yes a little more) ● parseInt(value, radix) ● Another way to convert a string to a number ● Radix – Base 10 the number system we all use is not the only one ● Octal base 8 – 8 digits 0...7 – 10 = 8, 11=9, 12=10, …. ● Hexadecimal Base 16 – 15 digits 0..9 then A..F – A = 10, B = 11, … F=15, 10=16, 11=17, …. – Leading with 0 makes value ocal, 0x hexadecimal – Older browsers the value defaulted to octal so use the radix can be value 1..32 10 would be the radix that we Humans like the best
  • 13. The Math Object ● The Math Object is automatically created and is globally available ● Methods include ● floor() ● round() ● sin() ● cos() ● tan() ● random() ● And many more
  • 14. Strings ● 0 or more characters represented as two hex digits ● UTF-16, for older browsers UCS2 ● There is no char data type as in other languages ● Here the equivilent is a string of length 1 ● Empty string ● X=““ is a string of length 0 in other words typeof returns string
  • 15. Strings(cont) ● String literals ● Are surrounded by Double " or single quotes ' ● Quotes can not be nested in quotes of the same type – 'this will "work" fine' – 'this will 'not work' at all' ● toString() ● Available on most wrapper type converts values to their string equivalents ● Can't handle null or undefined
  • 16. Strings (yea theres more) ● Escape characters ● allows you to use some special characters – ' allows you to use ' inside of a single quoted string – “ allows you to use double quotes in a double quoted string – n newline – t tab – backslash (escaping the escape)
  • 17. Some String Properties and Methods ● String() ● length ● substr() ● toLowerCase() ● toUpperCase() ● split() ● splice()
  • 18. Summary ● JavaScript primatives are Null, Undefined, Boolean, Number, String and Object ● The typeof operator can tell you the object type of a variable ● There are wrapper Objects for most primatives ● These wrapper object have useful methods ● Most things in JavaScript are objects
  • 19. Next: A Demo and then Operators