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

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 

Kürzlich hochgeladen (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

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