SlideShare a Scribd company logo
JavaScript introduction 1 ( Variables And Values )
JAVASCRIPT
VARIABLES AND VALUES
Victor Perez
/ INTRODUCTION
⁄⁄⁄
● Brendan Eich
● Mocha
● September, 1995 LiveScript
● December, 1995 JavaScript
● June, 1997 ECMAScript 1
● June, 1998 ECMAScript 2
● December, 1999 ECMAScript 3
● December, 2009 ECMAScript 5
● June, 2011 ECMAScript 5.1
● JScript
HISTORY
INTRODUCTION
⁄⁄⁄
JAVASCRIPT
INTRODUCTION
document.getElementById()
navigator.battery.charging
new Array()
console.log()
process.on()
encodeURI()
JSON.parse()
new XMLHttpRequest()
DOM API
Device API
JavaScript
Plugin API / Host Object
Node.js API
JavaScript
JavaScript
DOM API
⁄⁄⁄
GLOBAL OBJECTS
INTRODUCTION
Value properties
Infinity, NaN and undefined
Function properties
eval(), isFinite(), isNaN(), parseFloat(), parseInt(), decodeURI(), decodeURIComponent(), encodeURI() and encodeURIComponent()
Deprecated: escape() and unescape()
Objects
Object(), Function(), Boolean(), Error(), EvalError(), RangeError(), ReferenceError(), SyntaxError(), TypeError(), URIError(), Number(), Math(), Date(), String(),
RegExp(), Array(), JSON()
ECMAScript 6: Float32Array(), Float64Array(), Int8Array(), Int16Array(), Int32Array(), Uint8Array(), Uint16Array(), Uint32Array(), Uint8ClampedArray(),
Symbol(), Map(), Set(), WeakMap(), WeakSet(), ArrayBuffer(), DataView(), Generator(), Promise(), Reflect(), and Proxy()
Function scope
arguments
/ VARIABLES
⁄⁄⁄
● Must begin with:
○ a letter from the Unicode character set
○ $ dollar sign
○ _ underscore
● Subsequent characters can be:
○ letters and digits from the entire Unicode character set
○ dollar signs
○ underscores
● Reserved words are not allowed *next slide
IDENTIFIERS
INTRODUCTION
⁄⁄⁄
RESERVED WORDS
INTRODUCTION
Keywords & literals
break, delete, function, return, typeof, case, do, if, switch, var, catch, else, in, this, void, continue, instanceof, throw, while, debugger, finally, new, with, default, for, null
and try
literals: true and false
Future reserved words
class, enum, extends, super, const, export and import
Strict mode
implements, let, private, public, yield, interface, package, protected and static
also: arguments and eval
ECMAScript 3
abstract, double, goto, native, static, boolean, enum, implements, package, super, byte, export, import, private, synchronized, char, extends, int, protected, throws,
class, final, interface, public, transient, const, float, long, short, volatile
⁄⁄⁄
● Keyword var
● Declare multiple variables with the same var keyword
● Declared variables will contain the value undefined
● Initialize a variable
● Dynamic typing
● Repeated and omitted declarations
DECLARATION
VARIABLES
⁄⁄⁄
● global and function scope
SCOPE
VARIABLES
⁄⁄⁄
● No block scoping
● Will be added in ECMAScript 6 via keyword let
HOISTING
VARIABLES
/ VALUES
⁄⁄
V
⁄
DATA TYPES
VALUES
Primitive
Number 25 25.5
String "string" 'also a string'
Boolean true false
Special
Undefined undefined void 0
Null null
Composite
Object {a: 1, b: "string", c: true} new String ()
Array [1, "string", true] new Array ()
⁄⁄⁄
● Integer values and floating-point values
● double-precision 64-bit binary format IEEE 754 value
● Number.MAX_VALUE ± 1.7976931348623157e+308
● Number.MIN_VALUE ± 5e-324
● Integer between 2^53 and -2^53 (2^53 = 9007199254740992)
● Number.POSITIVE_INFINITY Infinity round(r) > Number.MAX_VALUE
● Number.NEGATIVE_INFINITY -Infinity round(r) < Number.MIN_VALUE
● Number.NaN NaN Not a Number
NUMBERS
VALUES
⁄⁄⁄
WORKING WITH NUMBERS
VALUES
● Math https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math
⁄⁄⁄
● Sequences of unsigned 16-bit values
● Immutable
● UTF-16
● String.length
○ Surrogate pair
TEXT
VALUES
⁄⁄⁄
WORKING WITH STRINGS
VALUES
⁄⁄⁄
● true
● false
● 3 == 1 false
● 3 == 3 true
BOOLEANS
VALUES
⁄⁄⁄
● keyword null
● undefined
○ not initialized
○ default return value of a function
○ function parameters for which no argument is supplied
● null & undefined don’t have any properties
UNDEFINED & NULL
VALUES
⁄⁄⁄
● Create
● mutable
● Comparison
○ Not by value
○ By reference
OBJECTS (BASIC)
VALUES
⁄⁄⁄
● string inherits String object
● number inherits Number object
● boolean inherits Boolean object
● Immutable
WRAPPER OBJECTS
VALUES
⁄⁄⁄
● Specialized object
● Zero-based
● 32-bit indexes
○ From 0 up to 4294967294 ( 2^32 - 2)
● Max elements 4294967295 ( 2^32 - 1)
○ RangeError
● mutable
ARRAYS
VALUES
⁄⁄⁄
WORKING WITH ARRAYS
VALUES
⁄⁄⁄
TYPEOF
VALUES
Value Result Notes
Undefined "undefined"
Null "object" bug http://www.2ality.com/2013/10/typeof-null.html
Boolean "boolean"
Number "number"
String "string"
Function object "function" Implements [[Call]] in ECMAScript terms
Any other object "object"
Other
Array "object" Array.isArray()
/a/ "object" / "function" in some browser "object" is conform to ECMAScript 5.1
IE < 9: typeof alert "object" Most old IE host objects where objects and not functions
/ TYPE CONVERSIONS
⁄⁄⁄
AUTOMATICALLY
TYPE CONVERSIONS
● To number
○ +anyType or -anyType
○ anyType -, *, / or % anyType
○ boolean, number or null + boolean, number or null
● To string
○ anyType + anyType ( as long both aren't a number, boolean or null)
● To boolean
○ !anyType
● Comparison operators ( except the strict equality )
○ valueOf() and toString()
⁄⁄⁄
EXPLICIT
TYPE CONVERSIONS
● Number()
○ parseInt(string, radix)
○ parseFloat(string)
● String()
● Boolean()
● Object()
⁄⁄⁄
NUMBERS
TYPE CONVERSIONS
Value String Boolean Object
0 "0" false new Number() or new Number(0)
-0 "0" false new Number(-0)
NaN "NaN" false new Number(NaN)
Infinity "Infinity" true new Number(Infinity)
-Infinity "-Infinity" true new Number(-Infinity)
1 ( any number > 0 ) "1" true new Number(1)
-1 ( any number < 0) "-1" true new Number(-1)
⁄⁄⁄
STRINGS
TYPE CONVERSIONS
Value Number Boolean Object
"24" 24 true new String("24")
"foo" NaN true new String("foo");
"" ( empty string ) 0 false new String() or new String("")
⁄⁄⁄
BOOLEANS
TYPE CONVERSIONS
Value Number String Object
true 1 true new Boolean(true)
false 0 false new Boolean() or new Boolean(false);
⁄⁄⁄
UNDEFINED & NULL
TYPE CONVERSIONS
● Can’t be convert to a Object
Value Number String Boolean
undefined NaN "undefined" false
null 0 "null” false
⁄⁄⁄
OBJECTS
TYPE CONVERSIONS
● From object to string
○ toString()
○ valueOf()
● From object to number
○ valueOf()
○ toString()
● From object to boolean always true
Value Number String Boolean
new Object() NaN "[object Object]" true
⁄⁄⁄
STANDARD BUILT-IN OBJECTS
TYPE CONVERSIONS
Value String Number
new Date() "Tue Apr 22 2014 12:13:49 GMT+0200"
* http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.5.2
1398165557386
Date.getTime()
new RegExp('^foo', 'i') "/^foo/i" NaN
new Array() (empty array)
""
Array.join()
0
new Array([24]) (array with a single element)
"24”
Array.join()
24 or NaN if the value can’t be cast to a number
new Array([24, "i"]) "24,i”
Array.join()
NaN
function (x, y) { return x + y; } "function (x, y) { return x + y; }"
* http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.4.2
NaN
new Error("foo")
new TypeError("foo")
"Error: foo"
"TypeError: foo"
NaN
/ QUESTIONS?
THANKS
@VICTORAPEREZ
vpjs@victor-perez.nl

More Related Content

What's hot (20)

Letswift Swift 3.0
Letswift Swift 3.0Letswift Swift 3.0
Letswift Swift 3.0
Sehyun Park
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming Language
Mohammed Irfan Shaikh
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
WebStackAcademy
 
SWIFT 3
SWIFT 3SWIFT 3
SWIFT 3
Chuong Huynh
 
ES6 in Real Life
ES6 in Real LifeES6 in Real Life
ES6 in Real Life
Domenic Denicola
 
DIWE - Working with MySQL Databases
DIWE - Working with MySQL DatabasesDIWE - Working with MySQL Databases
DIWE - Working with MySQL Databases
Rasan Samarasinghe
 
Kotlin
KotlinKotlin
Kotlin
YeldosTanikin
 
Javascript basic course
Javascript basic courseJavascript basic course
Javascript basic course
Tran Khoa
 
Functional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedFunctional Algebra: Monoids Applied
Functional Algebra: Monoids Applied
Susan Potter
 
Powerful JavaScript Tips and Best Practices
Powerful JavaScript Tips and Best PracticesPowerful JavaScript Tips and Best Practices
Powerful JavaScript Tips and Best Practices
Dragos Ionita
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
Dmitry Sheiko
 
Scala - brief intro
Scala - brief introScala - brief intro
Scala - brief intro
Razvan Cojocaru
 
Basic Javascript
Basic JavascriptBasic Javascript
Basic Javascript
Bunlong Van
 
JavaScript - Chapter 6 - Basic Functions
 JavaScript - Chapter 6 - Basic Functions JavaScript - Chapter 6 - Basic Functions
JavaScript - Chapter 6 - Basic Functions
WebStackAcademy
 
3 kotlin vs. java- what kotlin has that java does not
3  kotlin vs. java- what kotlin has that java does not3  kotlin vs. java- what kotlin has that java does not
3 kotlin vs. java- what kotlin has that java does not
Sergey Bandysik
 
3.1 javascript objects_DOM
3.1 javascript objects_DOM3.1 javascript objects_DOM
3.1 javascript objects_DOM
Jalpesh Vasa
 
Why Haskell
Why HaskellWhy Haskell
Why Haskell
Susan Potter
 
Functional Objects & Function and Closures
Functional Objects  & Function and ClosuresFunctional Objects  & Function and Closures
Functional Objects & Function and Closures
Sandip Kumar
 
10. session 10 loops and arrays
10. session 10   loops and arrays10. session 10   loops and arrays
10. session 10 loops and arrays
Phúc Đỗ
 
iOS Session-2
iOS Session-2iOS Session-2
iOS Session-2
Hussain Behestee
 
Letswift Swift 3.0
Letswift Swift 3.0Letswift Swift 3.0
Letswift Swift 3.0
Sehyun Park
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
WebStackAcademy
 
DIWE - Working with MySQL Databases
DIWE - Working with MySQL DatabasesDIWE - Working with MySQL Databases
DIWE - Working with MySQL Databases
Rasan Samarasinghe
 
Javascript basic course
Javascript basic courseJavascript basic course
Javascript basic course
Tran Khoa
 
Functional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedFunctional Algebra: Monoids Applied
Functional Algebra: Monoids Applied
Susan Potter
 
Powerful JavaScript Tips and Best Practices
Powerful JavaScript Tips and Best PracticesPowerful JavaScript Tips and Best Practices
Powerful JavaScript Tips and Best Practices
Dragos Ionita
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
Dmitry Sheiko
 
Basic Javascript
Basic JavascriptBasic Javascript
Basic Javascript
Bunlong Van
 
JavaScript - Chapter 6 - Basic Functions
 JavaScript - Chapter 6 - Basic Functions JavaScript - Chapter 6 - Basic Functions
JavaScript - Chapter 6 - Basic Functions
WebStackAcademy
 
3 kotlin vs. java- what kotlin has that java does not
3  kotlin vs. java- what kotlin has that java does not3  kotlin vs. java- what kotlin has that java does not
3 kotlin vs. java- what kotlin has that java does not
Sergey Bandysik
 
3.1 javascript objects_DOM
3.1 javascript objects_DOM3.1 javascript objects_DOM
3.1 javascript objects_DOM
Jalpesh Vasa
 
Functional Objects & Function and Closures
Functional Objects  & Function and ClosuresFunctional Objects  & Function and Closures
Functional Objects & Function and Closures
Sandip Kumar
 
10. session 10 loops and arrays
10. session 10   loops and arrays10. session 10   loops and arrays
10. session 10 loops and arrays
Phúc Đỗ
 

Viewers also liked (7)

Introduction to JavaScript Basics.
Introduction to JavaScript Basics.Introduction to JavaScript Basics.
Introduction to JavaScript Basics.
Hassan Ahmed Baig - Web Developer
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
Bala Narayanan
 
Variables
VariablesVariables
Variables
Hiba Armouche
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
Amit Tyagi
 
Javascript
JavascriptJavascript
Javascript
guest03a6e6
 
Variables
 Variables Variables
Variables
shoffma5
 
Types of Variables
Types of VariablesTypes of Variables
Types of Variables
Ali Mustafa
 
Ad

Similar to JavaScript introduction 1 ( Variables And Values ) (20)

An introduction to javascript
An introduction to javascriptAn introduction to javascript
An introduction to javascript
MD Sayem Ahmed
 
Javascript
JavascriptJavascript
Javascript
Manav Prasad
 
Fii Practic Frontend - BeeNear - laborator3
Fii Practic Frontend - BeeNear - laborator3Fii Practic Frontend - BeeNear - laborator3
Fii Practic Frontend - BeeNear - laborator3
BeeNear
 
Javascript essentials
Javascript essentialsJavascript essentials
Javascript essentials
Bedis ElAchèche
 
JavaScript and jQuery - Web Technologies (1019888BNR)
JavaScript and jQuery - Web Technologies (1019888BNR)JavaScript and jQuery - Web Technologies (1019888BNR)
JavaScript and jQuery - Web Technologies (1019888BNR)
Beat Signer
 
Java Script Introduction
Java Script IntroductionJava Script Introduction
Java Script Introduction
jason hu 金良胡
 
Javascript analysis
Javascript analysisJavascript analysis
Javascript analysis
Uchitha Bandara
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1
Troy Miles
 
Javascript
JavascriptJavascript
Javascript
Sunil Thakur
 
JavaScript.pptx
JavaScript.pptxJavaScript.pptx
JavaScript.pptx
KennyPratheepKumar
 
javascript teach
javascript teachjavascript teach
javascript teach
guest3732fa
 
JSBootcamp_White
JSBootcamp_WhiteJSBootcamp_White
JSBootcamp_White
guest3732fa
 
Short intro to ECMAScript
Short intro to ECMAScriptShort intro to ECMAScript
Short intro to ECMAScript
Jussi Pohjolainen
 
chap04.ppt
chap04.pptchap04.ppt
chap04.ppt
Varsha Uchagaonkar
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript Bootcamp
AndreCharland
 
javascript client side scripting la.pptx
javascript client side scripting la.pptxjavascript client side scripting la.pptx
javascript client side scripting la.pptx
lekhacce
 
Javascript
JavascriptJavascript
Javascript
vikram singh
 
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
javascript-variablesanddatatypes-130218094831-phpapp01.pdfjavascript-variablesanddatatypes-130218094831-phpapp01.pdf
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
AlexShon3
 
Introduction to Javascript and Typescript.pdf
Introduction to Javascript and Typescript.pdfIntroduction to Javascript and Typescript.pdf
Introduction to Javascript and Typescript.pdf
rony setyawansyah
 
Fewd week5 slides
Fewd week5 slidesFewd week5 slides
Fewd week5 slides
William Myers
 
An introduction to javascript
An introduction to javascriptAn introduction to javascript
An introduction to javascript
MD Sayem Ahmed
 
Fii Practic Frontend - BeeNear - laborator3
Fii Practic Frontend - BeeNear - laborator3Fii Practic Frontend - BeeNear - laborator3
Fii Practic Frontend - BeeNear - laborator3
BeeNear
 
JavaScript and jQuery - Web Technologies (1019888BNR)
JavaScript and jQuery - Web Technologies (1019888BNR)JavaScript and jQuery - Web Technologies (1019888BNR)
JavaScript and jQuery - Web Technologies (1019888BNR)
Beat Signer
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1
Troy Miles
 
javascript teach
javascript teachjavascript teach
javascript teach
guest3732fa
 
JSBootcamp_White
JSBootcamp_WhiteJSBootcamp_White
JSBootcamp_White
guest3732fa
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript Bootcamp
AndreCharland
 
javascript client side scripting la.pptx
javascript client side scripting la.pptxjavascript client side scripting la.pptx
javascript client side scripting la.pptx
lekhacce
 
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
javascript-variablesanddatatypes-130218094831-phpapp01.pdfjavascript-variablesanddatatypes-130218094831-phpapp01.pdf
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
AlexShon3
 
Introduction to Javascript and Typescript.pdf
Introduction to Javascript and Typescript.pdfIntroduction to Javascript and Typescript.pdf
Introduction to Javascript and Typescript.pdf
rony setyawansyah
 
Ad

Recently uploaded (20)

June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free DownloadViral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
Edge AI and Vision Alliance
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Cisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdfCisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdf
superdpz
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI FoundationsOracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free DownloadViral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
“Solving Tomorrow’s AI Problems Today with Cadence’s Newest Processor,” a Pre...
Edge AI and Vision Alliance
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Cisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdfCisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdf
superdpz
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI FoundationsOracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 

JavaScript introduction 1 ( Variables And Values )

  • 4. ⁄⁄⁄ ● Brendan Eich ● Mocha ● September, 1995 LiveScript ● December, 1995 JavaScript ● June, 1997 ECMAScript 1 ● June, 1998 ECMAScript 2 ● December, 1999 ECMAScript 3 ● December, 2009 ECMAScript 5 ● June, 2011 ECMAScript 5.1 ● JScript HISTORY INTRODUCTION
  • 6. ⁄⁄⁄ GLOBAL OBJECTS INTRODUCTION Value properties Infinity, NaN and undefined Function properties eval(), isFinite(), isNaN(), parseFloat(), parseInt(), decodeURI(), decodeURIComponent(), encodeURI() and encodeURIComponent() Deprecated: escape() and unescape() Objects Object(), Function(), Boolean(), Error(), EvalError(), RangeError(), ReferenceError(), SyntaxError(), TypeError(), URIError(), Number(), Math(), Date(), String(), RegExp(), Array(), JSON() ECMAScript 6: Float32Array(), Float64Array(), Int8Array(), Int16Array(), Int32Array(), Uint8Array(), Uint16Array(), Uint32Array(), Uint8ClampedArray(), Symbol(), Map(), Set(), WeakMap(), WeakSet(), ArrayBuffer(), DataView(), Generator(), Promise(), Reflect(), and Proxy() Function scope arguments
  • 8. ⁄⁄⁄ ● Must begin with: ○ a letter from the Unicode character set ○ $ dollar sign ○ _ underscore ● Subsequent characters can be: ○ letters and digits from the entire Unicode character set ○ dollar signs ○ underscores ● Reserved words are not allowed *next slide IDENTIFIERS INTRODUCTION
  • 9. ⁄⁄⁄ RESERVED WORDS INTRODUCTION Keywords & literals break, delete, function, return, typeof, case, do, if, switch, var, catch, else, in, this, void, continue, instanceof, throw, while, debugger, finally, new, with, default, for, null and try literals: true and false Future reserved words class, enum, extends, super, const, export and import Strict mode implements, let, private, public, yield, interface, package, protected and static also: arguments and eval ECMAScript 3 abstract, double, goto, native, static, boolean, enum, implements, package, super, byte, export, import, private, synchronized, char, extends, int, protected, throws, class, final, interface, public, transient, const, float, long, short, volatile
  • 10. ⁄⁄⁄ ● Keyword var ● Declare multiple variables with the same var keyword ● Declared variables will contain the value undefined ● Initialize a variable ● Dynamic typing ● Repeated and omitted declarations DECLARATION VARIABLES
  • 11. ⁄⁄⁄ ● global and function scope SCOPE VARIABLES
  • 12. ⁄⁄⁄ ● No block scoping ● Will be added in ECMAScript 6 via keyword let HOISTING VARIABLES
  • 14. ⁄⁄ V ⁄ DATA TYPES VALUES Primitive Number 25 25.5 String "string" 'also a string' Boolean true false Special Undefined undefined void 0 Null null Composite Object {a: 1, b: "string", c: true} new String () Array [1, "string", true] new Array ()
  • 15. ⁄⁄⁄ ● Integer values and floating-point values ● double-precision 64-bit binary format IEEE 754 value ● Number.MAX_VALUE ± 1.7976931348623157e+308 ● Number.MIN_VALUE ± 5e-324 ● Integer between 2^53 and -2^53 (2^53 = 9007199254740992) ● Number.POSITIVE_INFINITY Infinity round(r) > Number.MAX_VALUE ● Number.NEGATIVE_INFINITY -Infinity round(r) < Number.MIN_VALUE ● Number.NaN NaN Not a Number NUMBERS VALUES
  • 16. ⁄⁄⁄ WORKING WITH NUMBERS VALUES ● Math https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math
  • 17. ⁄⁄⁄ ● Sequences of unsigned 16-bit values ● Immutable ● UTF-16 ● String.length ○ Surrogate pair TEXT VALUES
  • 19. ⁄⁄⁄ ● true ● false ● 3 == 1 false ● 3 == 3 true BOOLEANS VALUES
  • 20. ⁄⁄⁄ ● keyword null ● undefined ○ not initialized ○ default return value of a function ○ function parameters for which no argument is supplied ● null & undefined don’t have any properties UNDEFINED & NULL VALUES
  • 21. ⁄⁄⁄ ● Create ● mutable ● Comparison ○ Not by value ○ By reference OBJECTS (BASIC) VALUES
  • 22. ⁄⁄⁄ ● string inherits String object ● number inherits Number object ● boolean inherits Boolean object ● Immutable WRAPPER OBJECTS VALUES
  • 23. ⁄⁄⁄ ● Specialized object ● Zero-based ● 32-bit indexes ○ From 0 up to 4294967294 ( 2^32 - 2) ● Max elements 4294967295 ( 2^32 - 1) ○ RangeError ● mutable ARRAYS VALUES
  • 25. ⁄⁄⁄ TYPEOF VALUES Value Result Notes Undefined "undefined" Null "object" bug http://www.2ality.com/2013/10/typeof-null.html Boolean "boolean" Number "number" String "string" Function object "function" Implements [[Call]] in ECMAScript terms Any other object "object" Other Array "object" Array.isArray() /a/ "object" / "function" in some browser "object" is conform to ECMAScript 5.1 IE < 9: typeof alert "object" Most old IE host objects where objects and not functions
  • 27. ⁄⁄⁄ AUTOMATICALLY TYPE CONVERSIONS ● To number ○ +anyType or -anyType ○ anyType -, *, / or % anyType ○ boolean, number or null + boolean, number or null ● To string ○ anyType + anyType ( as long both aren't a number, boolean or null) ● To boolean ○ !anyType ● Comparison operators ( except the strict equality ) ○ valueOf() and toString()
  • 28. ⁄⁄⁄ EXPLICIT TYPE CONVERSIONS ● Number() ○ parseInt(string, radix) ○ parseFloat(string) ● String() ● Boolean() ● Object()
  • 29. ⁄⁄⁄ NUMBERS TYPE CONVERSIONS Value String Boolean Object 0 "0" false new Number() or new Number(0) -0 "0" false new Number(-0) NaN "NaN" false new Number(NaN) Infinity "Infinity" true new Number(Infinity) -Infinity "-Infinity" true new Number(-Infinity) 1 ( any number > 0 ) "1" true new Number(1) -1 ( any number < 0) "-1" true new Number(-1)
  • 30. ⁄⁄⁄ STRINGS TYPE CONVERSIONS Value Number Boolean Object "24" 24 true new String("24") "foo" NaN true new String("foo"); "" ( empty string ) 0 false new String() or new String("")
  • 31. ⁄⁄⁄ BOOLEANS TYPE CONVERSIONS Value Number String Object true 1 true new Boolean(true) false 0 false new Boolean() or new Boolean(false);
  • 32. ⁄⁄⁄ UNDEFINED & NULL TYPE CONVERSIONS ● Can’t be convert to a Object Value Number String Boolean undefined NaN "undefined" false null 0 "null” false
  • 33. ⁄⁄⁄ OBJECTS TYPE CONVERSIONS ● From object to string ○ toString() ○ valueOf() ● From object to number ○ valueOf() ○ toString() ● From object to boolean always true Value Number String Boolean new Object() NaN "[object Object]" true
  • 34. ⁄⁄⁄ STANDARD BUILT-IN OBJECTS TYPE CONVERSIONS Value String Number new Date() "Tue Apr 22 2014 12:13:49 GMT+0200" * http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.5.2 1398165557386 Date.getTime() new RegExp('^foo', 'i') "/^foo/i" NaN new Array() (empty array) "" Array.join() 0 new Array([24]) (array with a single element) "24” Array.join() 24 or NaN if the value can’t be cast to a number new Array([24, "i"]) "24,i” Array.join() NaN function (x, y) { return x + y; } "function (x, y) { return x + y; }" * http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.4.2 NaN new Error("foo") new TypeError("foo") "Error: foo" "TypeError: foo" NaN