SlideShare una empresa de Scribd logo
1 de 40
Descargar para leer sin conexión
JAVASCRIPT
OPERATORS
Victor Perez
/ TO PRIMITIVE
⁄⁄⁄
● Preferred type, string or number
○ if no preferred type, default number except for instances of Date
CONVERSION
TO PRIMITIVE
⁄⁄⁄
● plus ( + )
● comparison ( <, <=, >, >=, ==, != )
○ in- and equality only if both aren't a object
PLUS AND COMPARISON
TO PRIMITIVE
/ OPERATORS
⁄⁄⁄
● Organized by operator precedence
● Punctuation characters
○ like: +, =, %
● Keywords
○ like: delete, void, typeof
● Associativity
○ LTR ( Left-to-right ) and RTL ( Right-to-left )
● Number of operands
○ 1 - 3
● Types
○ input type(s) → result type
INTRODUCTION
OPERATORS
⁄⁄⁄
INCREMENT
OPERATORS
● Pre- or post-increment
Operator Associativity Number of operands Types
++ Right-to-left 1 lvalue → number
⁄⁄⁄
DECREMENT
OPERATORS
● Pre- or post-decrement
Operator Associativity Number of operands Types
-- Right-to-left 1 lvalue → number
⁄⁄⁄
UNARY MINUS
OPERATORS
● Changes the sign of the result
Operator Associativity Number of operands Types
- Right-to-left 1 number → number
⁄⁄⁄
UNARY PLUS
OPERATORS
● Converts to a number
● See type conversion last presentation http://www.slideshare.net/victorandresperez/java-script-introduction-34306832/26
Operator Associativity Number of operands Types
+ Right-to-left 1 number → number
⁄⁄⁄
BITWISE NOT
OPERATORS
● Reversing all bits
● -( x + 1)
Operator Associativity Number of operands Types
~ Right-to-left 1 int → int
⁄⁄⁄
DELETE
OPERATORS
● Removes a property
○ returns true if the property was successful deleted
Operator Associativity Number of operands Types
delete Right-to-left 1 lvalue→ boolean
⁄⁄⁄
TYPEOF
OPERATORS
● Determine type of operand
○ http://www.slideshare.net/victorandresperez/java-script-introduction-34306832/25
Operator Associativity Number of operands Types
typeof Right-to-left 1 any → string
⁄⁄⁄
VOID
OPERATORS
● Evaluates its operand and then returns undefined
Operator Associativity Number of operands Types
void Right-to-left 1 any → undefined
⁄⁄⁄
MULTIPLY, DIVIDE & REMAINDER
OPERATORS
● Multiplication
● Division
● Modulo ( remainder after division )
Operator Associativity Number of operands Types
* Left-to-right 2 number, number → number
/ Left-to-right 2 number, number → number
% Left-to-right 2 number, number → number
⁄⁄⁄
ADD & SUBTRACT
OPERATORS
● Addition ( + )
● Subtraction ( - )
Operator Associativity Number of operands Types
+ Left-to-right 2 number, number → number
- Left-to-right 2 number, number → number
⁄⁄⁄
CONCATENATE STRINGS
OPERATORS
● Will concatenate both strings to a new string
Operator Associativity Number of operands Types
+ Left-to-right 2 string,string→ string
⁄⁄⁄
SHIFT LEFT
OPERATORS
● moves all bits in its first operand to the left by the number of places in the second operand
● between 0 and 31
● x * 2^y
Operator Associativity Number of operands Types
<< Left-to-right 2 int, int→ int
⁄⁄⁄
SHIFT RIGHT WITH SIGN
OPERATORS
● moves all bits in its first operand to the right by the number of places specified in the second operand
● between 0 and 31
Operator Associativity Number of operands Types
>> Left-to-right 2 int, int→ int
⁄⁄⁄
SHIFT RIGHT WITH ZERO FILL
OPERATORS
● Same as >> operator, except that the bits shifted in on the left are always zero
Operator Associativity Number of operands Types
>>> Left-to-right 2 int, int→ int
⁄⁄⁄
COMPARE NUMBERS
OPERATORS
● Less than ( < ), greater than ( > ), less than or equal ( <= ), greater than or equal ( >= )
Operator Associativity Number of operands Types
< Left-to-right 2 number, number→ boolean
> Left-to-right 2 number, number→ boolean
<= Left-to-right 2 number, number→ boolean
>= Left-to-right 2 number, number→ boolean
⁄⁄⁄
COMPARE STRINGS
OPERATORS
● Less than ( < ), greater than ( > ), less than or equal ( <= ), greater than or equal ( >= )
● 16-bit integers
● Capital ASCII is less than lowercase ASCII
Operator Associativity Number of operands Types
< Left-to-right 2 string, string → boolean
> Left-to-right 2 string, string → boolean
<= Left-to-right 2 string, string → boolean
>= Left-to-right 2 string, string → boolean
⁄⁄⁄
INSTANCEOF
OPERATORS
● Checks of the left operand is an instanceof the right operand
Operator Associativity Number of operands Types
instanceof Left-to-right 2 object,function→ boolean
⁄⁄⁄
IN
OPERATORS
● Checks of the left-side value is a property in the right-side value
Operator Associativity Number of operands Types
in Left-to-right 2 string,object→ boolean
⁄⁄⁄
EQUALITY
OPERATORS
● Checks of both operands are equal
● 2 objects are check by references
● Type conversion if types are not equal
Operator Associativity Number of operands Types
== Left-to-right 2 any,any→ boolean
⁄⁄⁄
INEQUALITY
OPERATORS
● Checks of both operands are not equal
● 2 objects are check by references
● Type conversion if types are not equal
Operator Associativity Number of operands Types
!= Left-to-right 2 any,any→ boolean
⁄⁄⁄
STRICT EQUALITY
OPERATORS
● Checks of both operands are equal
● 2 objects are check by references
Operator Associativity Number of operands Types
=== Left-to-right 2 any,any→ boolean
⁄⁄⁄
STRICT INEQUALITY
OPERATORS
● Checks of both operands are not equal
● 2 objects are check by references
Operator Associativity Number of operands Types
!== Left-to-right 2 any,any→ boolean
⁄⁄⁄
BITWISE AND
OPERATORS
● Performs the AND operation on each pair of bits
○ yields 1 if both bits are 1, else yields 0
Operator Associativity Number of operands Types
& Left-to-right 2 int,int→ int
⁄⁄⁄
BITWISE XOR
OPERATORS
● Performs the XOR operation on each pair of bits
○ yields 1 if both bits not equal, else yields 0
Operator Associativity Number of operands Types
^ Left-to-right 2 int,int→ int
⁄⁄⁄
BITWISE OR
OPERATORS
● Performs the OR operation on each pair of bits
○ yields 0 if both bits are 0, else yields 1
Operator Associativity Number of operands Types
| Left-to-right 2 int,int→ int
⁄⁄⁄
LOGICAL AND
OPERATORS
● Returns a “truthy” or “falsy” value
● Returns the left operand if the left operand is “falsy”, else return right operand
● “falsy” values are: false, null, undefined, 0, -0, NaN and empty string ( "" )
Operator Associativity Number of operands Types
&& Left-to-right 2 any,any→ any
⁄⁄⁄
LOGICAL OR
OPERATORS
● Returns a “truthy” or “falsy” value
● Returns the left operand if the left operand is “truthy”, else return right operand
● “falsy” values are: false, null, undefined, 0, -0, NaN and empty string ( "" )
Operator Associativity Number of operands Types
|| Left-to-right 2 any,any→ any
⁄⁄⁄
CONDITIONAL OPERATOR
OPERATORS
● The only ternary operator ( three operands )
● if first operand is “truly”, then the second operand is evaluated, else the third operand
Operator Associativity Number of operands Types
?: Right-to-left 3 boolean,any,any→ any
⁄⁄⁄
ASSIGNMENT
OPERATORS
● Assign to a variable or property
Operator Associativity Number of operands Types
= Right-to-left 2 lvalue,any→ any
⁄⁄⁄
OPERATE AND ASSIGN
OPERATORS
● a operate= b is the same as a = a operate b
Operators Associativity Number of operands Types
*=, /=, %=, +=, -=, &=, ^=,
|=, <<=, >>=, >>>=
Right-to-left 2 lvalue,any→ any
Operator Example Equivalent
+=
-=
*=
/=
%=
<<=
>>=
>>>=
&=
|=
^=
a += b
a -= b
a *= b
a /= b
a %= b
a <<= b
a >>= b
a >>>= b
a &= b
a |= b
a ^= b
a = a + b
a = a - b
a = a * b
a = a / b
a = a % b
a = a << b
a = a >> b
a = a >>> b
a = a & b
a = a | b
a = a ^ b
⁄⁄⁄
COMMA
OPERATORS
● Evaluates the left operand, then the right operand and then returns the value of the right operand.
Operators Associativity Number of operands Types
, Left-to-right 2 any,any→ any
/ QUESTIONS?
THANKS
@VICTORAPEREZ
vpjs@victor-perez.nl

Más contenido relacionado

La actualidad más candente

Functional Javascript
Functional JavascriptFunctional Javascript
Functional Javascriptguest4d57e6
 
Angular 2.0: Brighter future?
Angular 2.0: Brighter future?Angular 2.0: Brighter future?
Angular 2.0: Brighter future?Eugene Zharkov
 
JavaScript Object Oriented Programming Cheat Sheet
JavaScript Object Oriented Programming Cheat SheetJavaScript Object Oriented Programming Cheat Sheet
JavaScript Object Oriented Programming Cheat SheetHDR1001
 
Functions and Objects in JavaScript
Functions and Objects in JavaScript Functions and Objects in JavaScript
Functions and Objects in JavaScript Dhananjay Kumar
 
JavaScript: Patterns, Part 3
JavaScript: Patterns, Part  3JavaScript: Patterns, Part  3
JavaScript: Patterns, Part 3Chris Farrell
 
JavaScript Functions
JavaScript FunctionsJavaScript Functions
JavaScript FunctionsColin DeCarlo
 
Functional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioFunctional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioLuis Atencio
 
Functional programming with Ruby - can make you look smart
Functional programming with Ruby - can make you look smartFunctional programming with Ruby - can make you look smart
Functional programming with Ruby - can make you look smartChen Fisher
 
Ruby Functional Programming
Ruby Functional ProgrammingRuby Functional Programming
Ruby Functional ProgrammingGeison Goes
 
Airbnb Javascript Style Guide
Airbnb Javascript Style GuideAirbnb Javascript Style Guide
Airbnb Javascript Style GuideCreative Partners
 
Reactive Programming with JavaScript
Reactive Programming with JavaScriptReactive Programming with JavaScript
Reactive Programming with JavaScriptCodemotion
 
Maintainable JavaScript
Maintainable JavaScriptMaintainable JavaScript
Maintainable JavaScriptNicholas Zakas
 
Introduction to Object Oriented Javascript
Introduction to Object Oriented JavascriptIntroduction to Object Oriented Javascript
Introduction to Object Oriented Javascriptnodeninjas
 
Operator overloading
Operator overloadingOperator overloading
Operator overloadingArunaDevi63
 
Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScriptWill Livengood
 
From object oriented to functional domain modeling
From object oriented to functional domain modelingFrom object oriented to functional domain modeling
From object oriented to functional domain modelingCodemotion
 

La actualidad más candente (20)

Scala - core features
Scala - core featuresScala - core features
Scala - core features
 
Operators in Java
Operators in JavaOperators in Java
Operators in Java
 
Functional Javascript
Functional JavascriptFunctional Javascript
Functional Javascript
 
Angular 2.0: Brighter future?
Angular 2.0: Brighter future?Angular 2.0: Brighter future?
Angular 2.0: Brighter future?
 
JavaScript Object Oriented Programming Cheat Sheet
JavaScript Object Oriented Programming Cheat SheetJavaScript Object Oriented Programming Cheat Sheet
JavaScript Object Oriented Programming Cheat Sheet
 
Functions and Objects in JavaScript
Functions and Objects in JavaScript Functions and Objects in JavaScript
Functions and Objects in JavaScript
 
JavaScript: Patterns, Part 3
JavaScript: Patterns, Part  3JavaScript: Patterns, Part  3
JavaScript: Patterns, Part 3
 
JavaScript Functions
JavaScript FunctionsJavaScript Functions
JavaScript Functions
 
Let's JavaScript
Let's JavaScriptLet's JavaScript
Let's JavaScript
 
Functional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioFunctional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis Atencio
 
Functional programming with Ruby - can make you look smart
Functional programming with Ruby - can make you look smartFunctional programming with Ruby - can make you look smart
Functional programming with Ruby - can make you look smart
 
Ruby Functional Programming
Ruby Functional ProgrammingRuby Functional Programming
Ruby Functional Programming
 
Airbnb Javascript Style Guide
Airbnb Javascript Style GuideAirbnb Javascript Style Guide
Airbnb Javascript Style Guide
 
Client sidescripting javascript
Client sidescripting javascriptClient sidescripting javascript
Client sidescripting javascript
 
Reactive Programming with JavaScript
Reactive Programming with JavaScriptReactive Programming with JavaScript
Reactive Programming with JavaScript
 
Maintainable JavaScript
Maintainable JavaScriptMaintainable JavaScript
Maintainable JavaScript
 
Introduction to Object Oriented Javascript
Introduction to Object Oriented JavascriptIntroduction to Object Oriented Javascript
Introduction to Object Oriented Javascript
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScript
 
From object oriented to functional domain modeling
From object oriented to functional domain modelingFrom object oriented to functional domain modeling
From object oriented to functional domain modeling
 

Similar a JavaScript operators (20)

Java script operators
Java script operatorsJava script operators
Java script operators
 
operators in c++
operators in c++operators in c++
operators in c++
 
operators in c++
operators in c++operators in c++
operators in c++
 
OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++
 
4_A1208223655_21789_2_2018_04. Operators.ppt
4_A1208223655_21789_2_2018_04. Operators.ppt4_A1208223655_21789_2_2018_04. Operators.ppt
4_A1208223655_21789_2_2018_04. Operators.ppt
 
c# operators
c# operatorsc# operators
c# operators
 
SPL 6 | Operators in C
SPL 6 | Operators in CSPL 6 | Operators in C
SPL 6 | Operators in C
 
Operators in C/C++
Operators in C/C++Operators in C/C++
Operators in C/C++
 
Operators
OperatorsOperators
Operators
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 
Operators in Python
Operators in PythonOperators in Python
Operators in Python
 
Operators in c++
Operators in c++Operators in c++
Operators in c++
 
itft-Operators in java
itft-Operators in javaitft-Operators in java
itft-Operators in java
 
Operators in java
Operators in javaOperators in java
Operators in java
 
10)OPERATORS.pdf
10)OPERATORS.pdf10)OPERATORS.pdf
10)OPERATORS.pdf
 
Logical Operators C/C++ language Programming
Logical Operators C/C++ language ProgrammingLogical Operators C/C++ language Programming
Logical Operators C/C++ language Programming
 
SQL Operator.pdf
SQL Operator.pdfSQL Operator.pdf
SQL Operator.pdf
 
Operators
OperatorsOperators
Operators
 
Operator 04 (js)
Operator 04 (js)Operator 04 (js)
Operator 04 (js)
 
Opeartor &amp; expression
Opeartor &amp; expressionOpeartor &amp; expression
Opeartor &amp; expression
 

Último

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 

Último (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 

JavaScript operators

  • 1.
  • 4. ⁄⁄⁄ ● Preferred type, string or number ○ if no preferred type, default number except for instances of Date CONVERSION TO PRIMITIVE
  • 5. ⁄⁄⁄ ● plus ( + ) ● comparison ( <, <=, >, >=, ==, != ) ○ in- and equality only if both aren't a object PLUS AND COMPARISON TO PRIMITIVE
  • 7. ⁄⁄⁄ ● Organized by operator precedence ● Punctuation characters ○ like: +, =, % ● Keywords ○ like: delete, void, typeof ● Associativity ○ LTR ( Left-to-right ) and RTL ( Right-to-left ) ● Number of operands ○ 1 - 3 ● Types ○ input type(s) → result type INTRODUCTION OPERATORS
  • 8. ⁄⁄⁄ INCREMENT OPERATORS ● Pre- or post-increment Operator Associativity Number of operands Types ++ Right-to-left 1 lvalue → number
  • 9. ⁄⁄⁄ DECREMENT OPERATORS ● Pre- or post-decrement Operator Associativity Number of operands Types -- Right-to-left 1 lvalue → number
  • 10. ⁄⁄⁄ UNARY MINUS OPERATORS ● Changes the sign of the result Operator Associativity Number of operands Types - Right-to-left 1 number → number
  • 11. ⁄⁄⁄ UNARY PLUS OPERATORS ● Converts to a number ● See type conversion last presentation http://www.slideshare.net/victorandresperez/java-script-introduction-34306832/26 Operator Associativity Number of operands Types + Right-to-left 1 number → number
  • 12. ⁄⁄⁄ BITWISE NOT OPERATORS ● Reversing all bits ● -( x + 1) Operator Associativity Number of operands Types ~ Right-to-left 1 int → int
  • 13. ⁄⁄⁄ DELETE OPERATORS ● Removes a property ○ returns true if the property was successful deleted Operator Associativity Number of operands Types delete Right-to-left 1 lvalue→ boolean
  • 14. ⁄⁄⁄ TYPEOF OPERATORS ● Determine type of operand ○ http://www.slideshare.net/victorandresperez/java-script-introduction-34306832/25 Operator Associativity Number of operands Types typeof Right-to-left 1 any → string
  • 15. ⁄⁄⁄ VOID OPERATORS ● Evaluates its operand and then returns undefined Operator Associativity Number of operands Types void Right-to-left 1 any → undefined
  • 16. ⁄⁄⁄ MULTIPLY, DIVIDE & REMAINDER OPERATORS ● Multiplication ● Division ● Modulo ( remainder after division ) Operator Associativity Number of operands Types * Left-to-right 2 number, number → number / Left-to-right 2 number, number → number % Left-to-right 2 number, number → number
  • 17. ⁄⁄⁄ ADD & SUBTRACT OPERATORS ● Addition ( + ) ● Subtraction ( - ) Operator Associativity Number of operands Types + Left-to-right 2 number, number → number - Left-to-right 2 number, number → number
  • 18. ⁄⁄⁄ CONCATENATE STRINGS OPERATORS ● Will concatenate both strings to a new string Operator Associativity Number of operands Types + Left-to-right 2 string,string→ string
  • 19. ⁄⁄⁄ SHIFT LEFT OPERATORS ● moves all bits in its first operand to the left by the number of places in the second operand ● between 0 and 31 ● x * 2^y Operator Associativity Number of operands Types << Left-to-right 2 int, int→ int
  • 20. ⁄⁄⁄ SHIFT RIGHT WITH SIGN OPERATORS ● moves all bits in its first operand to the right by the number of places specified in the second operand ● between 0 and 31 Operator Associativity Number of operands Types >> Left-to-right 2 int, int→ int
  • 21. ⁄⁄⁄ SHIFT RIGHT WITH ZERO FILL OPERATORS ● Same as >> operator, except that the bits shifted in on the left are always zero Operator Associativity Number of operands Types >>> Left-to-right 2 int, int→ int
  • 22. ⁄⁄⁄ COMPARE NUMBERS OPERATORS ● Less than ( < ), greater than ( > ), less than or equal ( <= ), greater than or equal ( >= ) Operator Associativity Number of operands Types < Left-to-right 2 number, number→ boolean > Left-to-right 2 number, number→ boolean <= Left-to-right 2 number, number→ boolean >= Left-to-right 2 number, number→ boolean
  • 23. ⁄⁄⁄ COMPARE STRINGS OPERATORS ● Less than ( < ), greater than ( > ), less than or equal ( <= ), greater than or equal ( >= ) ● 16-bit integers ● Capital ASCII is less than lowercase ASCII Operator Associativity Number of operands Types < Left-to-right 2 string, string → boolean > Left-to-right 2 string, string → boolean <= Left-to-right 2 string, string → boolean >= Left-to-right 2 string, string → boolean
  • 24. ⁄⁄⁄ INSTANCEOF OPERATORS ● Checks of the left operand is an instanceof the right operand Operator Associativity Number of operands Types instanceof Left-to-right 2 object,function→ boolean
  • 25. ⁄⁄⁄ IN OPERATORS ● Checks of the left-side value is a property in the right-side value Operator Associativity Number of operands Types in Left-to-right 2 string,object→ boolean
  • 26. ⁄⁄⁄ EQUALITY OPERATORS ● Checks of both operands are equal ● 2 objects are check by references ● Type conversion if types are not equal Operator Associativity Number of operands Types == Left-to-right 2 any,any→ boolean
  • 27. ⁄⁄⁄ INEQUALITY OPERATORS ● Checks of both operands are not equal ● 2 objects are check by references ● Type conversion if types are not equal Operator Associativity Number of operands Types != Left-to-right 2 any,any→ boolean
  • 28. ⁄⁄⁄ STRICT EQUALITY OPERATORS ● Checks of both operands are equal ● 2 objects are check by references Operator Associativity Number of operands Types === Left-to-right 2 any,any→ boolean
  • 29. ⁄⁄⁄ STRICT INEQUALITY OPERATORS ● Checks of both operands are not equal ● 2 objects are check by references Operator Associativity Number of operands Types !== Left-to-right 2 any,any→ boolean
  • 30. ⁄⁄⁄ BITWISE AND OPERATORS ● Performs the AND operation on each pair of bits ○ yields 1 if both bits are 1, else yields 0 Operator Associativity Number of operands Types & Left-to-right 2 int,int→ int
  • 31. ⁄⁄⁄ BITWISE XOR OPERATORS ● Performs the XOR operation on each pair of bits ○ yields 1 if both bits not equal, else yields 0 Operator Associativity Number of operands Types ^ Left-to-right 2 int,int→ int
  • 32. ⁄⁄⁄ BITWISE OR OPERATORS ● Performs the OR operation on each pair of bits ○ yields 0 if both bits are 0, else yields 1 Operator Associativity Number of operands Types | Left-to-right 2 int,int→ int
  • 33. ⁄⁄⁄ LOGICAL AND OPERATORS ● Returns a “truthy” or “falsy” value ● Returns the left operand if the left operand is “falsy”, else return right operand ● “falsy” values are: false, null, undefined, 0, -0, NaN and empty string ( "" ) Operator Associativity Number of operands Types && Left-to-right 2 any,any→ any
  • 34. ⁄⁄⁄ LOGICAL OR OPERATORS ● Returns a “truthy” or “falsy” value ● Returns the left operand if the left operand is “truthy”, else return right operand ● “falsy” values are: false, null, undefined, 0, -0, NaN and empty string ( "" ) Operator Associativity Number of operands Types || Left-to-right 2 any,any→ any
  • 35. ⁄⁄⁄ CONDITIONAL OPERATOR OPERATORS ● The only ternary operator ( three operands ) ● if first operand is “truly”, then the second operand is evaluated, else the third operand Operator Associativity Number of operands Types ?: Right-to-left 3 boolean,any,any→ any
  • 36. ⁄⁄⁄ ASSIGNMENT OPERATORS ● Assign to a variable or property Operator Associativity Number of operands Types = Right-to-left 2 lvalue,any→ any
  • 37. ⁄⁄⁄ OPERATE AND ASSIGN OPERATORS ● a operate= b is the same as a = a operate b Operators Associativity Number of operands Types *=, /=, %=, +=, -=, &=, ^=, |=, <<=, >>=, >>>= Right-to-left 2 lvalue,any→ any Operator Example Equivalent += -= *= /= %= <<= >>= >>>= &= |= ^= a += b a -= b a *= b a /= b a %= b a <<= b a >>= b a >>>= b a &= b a |= b a ^= b a = a + b a = a - b a = a * b a = a / b a = a % b a = a << b a = a >> b a = a >>> b a = a & b a = a | b a = a ^ b
  • 38. ⁄⁄⁄ COMMA OPERATORS ● Evaluates the left operand, then the right operand and then returns the value of the right operand. Operators Associativity Number of operands Types , Left-to-right 2 any,any→ any