SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Kürzlich hochgeladen (20)

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

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