SlideShare a Scribd company logo
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
1
Operators in JavaScript
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
2
Contents
• Introduction to Operators
• Various Categories of Operators
• Usage of various Operators in Scripts
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
3
Operators
• An operator is used to transform one or more values into a
single resultant value.
• The value to which the operator is applied is referred as
operands.
• A combination of an operator and its operands is referred to
as an expression.
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
4
Arithmetic
Comparison
StringConditional
Assignment
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
5
Arithmetic Operators
• Arithmetic operators are the most familiar operators
because they are used every day to solve common math
calculations
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulous (Remainder after
division)
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
6
Arithmetic Operators
++ increment operator
_ _ decrement operator
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
7
<html>
<head> <title>Arithmetic Operators</title</head>
<body>
<script language="javascript">
a=20;b=3;
document.write("sum="+(a+b));
document.write("<br> remainder="+(a%b));
document.write("<br> increment="+(++a));
document.write("<br> decrement="+(--b)); </script>
</body>
</html>
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
8
Comparison Operators
• Comparision operators are used to compare two
values.
== Equal
!= Not equal
< = Less than or equal to
>= Greater than or equal to
==== Strictly equal
!== Strictly not equal
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
9
Continued..
• The equal(==) and not equal to (!=) operators
perform type casting for equality. For e.g. “5” ==
5 evaluate to true.
• The strictly equal(===) and strictly not equal to
(!==) operators perform type casting for equality.
For e.g. “5” === 5 evaluate
to false.
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
10
<html>
<head><title>Comparison Operator</title>
</head>
<body> <script language="javascript">
document.write("[5>6]->" + (5>6));
document.write("<br>[10<=15]->" + (10<=15));
document.write("<br>[4==6]->" + (4==6));
document.write("<br>[7!=8]->"+(7!=8));
</script>
</body>
</html>
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
11
String Operators
• String operators are those operators that are used to
perform operations on strings.
• Currently, JavaScript supports only the string
concatenation (+) operator.
• This operator is used to join two strings. For e.g.,
“pq” + “ab” produces “pqab”.
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
12
<html>
<head><title>String Operator</title>
</head>
<body>
<script language="javascript">
var c=3+5+"6";
var d=c;
document.write("hello"+"world");
document.write("<br>"+ 3 + "6");
document.write("<br>"+ 3 + 5 +"6");
document.write("<br>result =" +d);
</script> </body></html>
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
13
Assignment Operators
• The assignment operator is used to update the value
of a variable.
• Some assignment operators are combined with
other operators to perform a computation on the
value contained in a update the variable with the
new value.
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
14
Assignment Operators….
= sets the variable on the left of
the = operator to the value of
the expression on its right.
+= increments the variable on the
left of the += operator of the
expression on its right.
-= decrements the variable on the
left of the -= operator of the
expression on its right.
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
15
Assignment Operators….
*= multiplies the variable on the
left of the *= operator to the
value of the expression on its
right.
/= divides the variable on the
left of the /= operator of the
expression on its right.
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
16
<html>
<head><title>Assignment Operator
</title></head>
<body>
<script language="javascript"> a=3; b=6;
document.write("[a+=6]->"+(a+=6));
document.write("<br>[b*=5]->"+(b*=5)); </script>
</body>
</html>
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
17
Conditional Operators
• JavaScript supports the conditional expression
operator.
• They are ? And :
• The conditional expression operator is a ternary
operator since it takes three operands, a condition to
be evaluated and two alternative values to be
returned based on truth and falsity of a condition
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
18
Conditional Operators….
Syntax:
Condition ? Value1:value2
The condition expressed must return a value true or
false. If the condition is true, value 1 is the result of
the expression, otherwise value 2 is the result of the
expression
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
19
<html>
<head><title>Conditional Operator
</title></head>
<body>
<script language="javascript">
a=8;b=6;
c=a>b?a:b;
document.write(c+"is greater");
</script>
</body>
</html>
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
20
7/20/2015
Presented by:- Ms. Deepti Tara, Assoc. Prof.,
UIC, CU
21

More Related Content

What's hot

Javascript
JavascriptJavascript
Javascript
Manav Prasad
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
Hatem Mahmoud
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
Varun C M
 
Introduction to JavaScript Basics.
Introduction to JavaScript Basics.Introduction to JavaScript Basics.
Introduction to JavaScript Basics.
Hassan Ahmed Baig - Web Developer
 
Css selectors
Css selectorsCss selectors
Css selectors
Parth Trivedi
 
Css Ppt
Css PptCss Ppt
Css Ppt
Hema Prasanth
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
Salman Memon
 
PHP FUNCTIONS
PHP FUNCTIONSPHP FUNCTIONS
PHP FUNCTIONS
Zeeshan Ahmed
 
Javascript 101
Javascript 101Javascript 101
Javascript 101
Shlomi Komemi
 
Php mysql ppt
Php mysql pptPhp mysql ppt
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
Arulmurugan Rajaraman
 
Javascript
JavascriptJavascript
Javascript
Nagarajan
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
Manvendra Singh
 
javascript objects
javascript objectsjavascript objects
javascript objects
Vijay Kalyan
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
ShahDhruv21
 
Data types in php
Data types in phpData types in php
Data types in php
ilakkiya
 
Php string function
Php string function Php string function
Php string function
Ravi Bhadauria
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
Priya Goyal
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
Knoldus Inc.
 
Java script array
Java script arrayJava script array
Java script array
chauhankapil
 

What's hot (20)

Javascript
JavascriptJavascript
Javascript
 
Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01Cascading Style Sheets - Part 01
Cascading Style Sheets - Part 01
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Introduction to JavaScript Basics.
Introduction to JavaScript Basics.Introduction to JavaScript Basics.
Introduction to JavaScript Basics.
 
Css selectors
Css selectorsCss selectors
Css selectors
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
PHP FUNCTIONS
PHP FUNCTIONSPHP FUNCTIONS
PHP FUNCTIONS
 
Javascript 101
Javascript 101Javascript 101
Javascript 101
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
 
javascript objects
javascript objectsjavascript objects
javascript objects
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
 
Data types in php
Data types in phpData types in php
Data types in php
 
Php string function
Php string function Php string function
Php string function
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
Java script array
Java script arrayJava script array
Java script array
 

Similar to Javascript operators

Nuno
NunoNuno
Google maps
Google mapsGoogle maps
Google maps
Muhammed M Bassem
 
Data Pipelines -Big Data Meets Salesforce
Data Pipelines -Big Data Meets SalesforceData Pipelines -Big Data Meets Salesforce
Data Pipelines -Big Data Meets Salesforce
CarolEnLaNube
 
Data Pipelines: Big Data Meets Salesforce
Data Pipelines: Big Data Meets SalesforceData Pipelines: Big Data Meets Salesforce
Data Pipelines: Big Data Meets Salesforce
Salesforce Developers
 
Building a Single Page App: One Page at a Time
Building a Single Page App: One Page at a TimeBuilding a Single Page App: One Page at a Time
Building a Single Page App: One Page at a Time
Ivayr Farah Netto
 
Contributing swift
Contributing swiftContributing swift
Contributing swift
Yuki Kuroda
 
Webcast: Pragmatic REST: The Next Generation
Webcast: Pragmatic REST: The Next GenerationWebcast: Pragmatic REST: The Next Generation
Webcast: Pragmatic REST: The Next Generation
Apigee | Google Cloud
 
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis LazuliGetting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Rebecca Eloise Hogg
 
Data Pipelines - Big Data meets Salesforce
Data Pipelines - Big Data meets SalesforceData Pipelines - Big Data meets Salesforce
Data Pipelines - Big Data meets Salesforce
agarciaodeian
 
Emergent Design: History, Concepts, and Principles
Emergent Design: History, Concepts, and PrinciplesEmergent Design: History, Concepts, and Principles
Emergent Design: History, Concepts, and Principles
TechWell
 
Practical Accessibility
Practical AccessibilityPractical Accessibility
Practical Accessibility
Eli Cochran
 
To Microservices and Beyond
To Microservices and BeyondTo Microservices and Beyond
To Microservices and Beyond
Matt Stine
 
C programming slide c03
C programming slide c03C programming slide c03
C programming slide c03
pradeep dwivedi
 
2018-10-18 J2 4C - its gonna be PowerApps and Flow - Penelope Coventry
2018-10-18 J2 4C - its gonna be PowerApps and Flow - Penelope Coventry2018-10-18 J2 4C - its gonna be PowerApps and Flow - Penelope Coventry
2018-10-18 J2 4C - its gonna be PowerApps and Flow - Penelope Coventry
Modern Workplace Conference Paris
 
Selenium Openhouse CP-SAT - Handling Dynamic Web Tables
Selenium Openhouse CP-SAT - Handling Dynamic Web TablesSelenium Openhouse CP-SAT - Handling Dynamic Web Tables
Selenium Openhouse CP-SAT - Handling Dynamic Web Tables
Agile Testing Alliance
 
DevLearn 2018 - Designing AR Experiences for Performance Support
DevLearn 2018 -  Designing AR Experiences for Performance SupportDevLearn 2018 -  Designing AR Experiences for Performance Support
DevLearn 2018 - Designing AR Experiences for Performance Support
Chad Udell
 
Fitman webinar 2015 09-21 Generation and Transformation of Virtualized Assets...
Fitman webinar 2015 09-21 Generation and Transformation of Virtualized Assets...Fitman webinar 2015 09-21 Generation and Transformation of Virtualized Assets...
Fitman webinar 2015 09-21 Generation and Transformation of Virtualized Assets...
FITMAN FI
 
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018) Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Zend by Rogue Wave Software
 
What's New in Java 8
What's New in Java 8What's New in Java 8
What's New in Java 8
javafxpert
 
JavaScript_III.pptx
JavaScript_III.pptxJavaScript_III.pptx
JavaScript_III.pptx
rashmiisrani1
 

Similar to Javascript operators (20)

Nuno
NunoNuno
Nuno
 
Google maps
Google mapsGoogle maps
Google maps
 
Data Pipelines -Big Data Meets Salesforce
Data Pipelines -Big Data Meets SalesforceData Pipelines -Big Data Meets Salesforce
Data Pipelines -Big Data Meets Salesforce
 
Data Pipelines: Big Data Meets Salesforce
Data Pipelines: Big Data Meets SalesforceData Pipelines: Big Data Meets Salesforce
Data Pipelines: Big Data Meets Salesforce
 
Building a Single Page App: One Page at a Time
Building a Single Page App: One Page at a TimeBuilding a Single Page App: One Page at a Time
Building a Single Page App: One Page at a Time
 
Contributing swift
Contributing swiftContributing swift
Contributing swift
 
Webcast: Pragmatic REST: The Next Generation
Webcast: Pragmatic REST: The Next GenerationWebcast: Pragmatic REST: The Next Generation
Webcast: Pragmatic REST: The Next Generation
 
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis LazuliGetting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
 
Data Pipelines - Big Data meets Salesforce
Data Pipelines - Big Data meets SalesforceData Pipelines - Big Data meets Salesforce
Data Pipelines - Big Data meets Salesforce
 
Emergent Design: History, Concepts, and Principles
Emergent Design: History, Concepts, and PrinciplesEmergent Design: History, Concepts, and Principles
Emergent Design: History, Concepts, and Principles
 
Practical Accessibility
Practical AccessibilityPractical Accessibility
Practical Accessibility
 
To Microservices and Beyond
To Microservices and BeyondTo Microservices and Beyond
To Microservices and Beyond
 
C programming slide c03
C programming slide c03C programming slide c03
C programming slide c03
 
2018-10-18 J2 4C - its gonna be PowerApps and Flow - Penelope Coventry
2018-10-18 J2 4C - its gonna be PowerApps and Flow - Penelope Coventry2018-10-18 J2 4C - its gonna be PowerApps and Flow - Penelope Coventry
2018-10-18 J2 4C - its gonna be PowerApps and Flow - Penelope Coventry
 
Selenium Openhouse CP-SAT - Handling Dynamic Web Tables
Selenium Openhouse CP-SAT - Handling Dynamic Web TablesSelenium Openhouse CP-SAT - Handling Dynamic Web Tables
Selenium Openhouse CP-SAT - Handling Dynamic Web Tables
 
DevLearn 2018 - Designing AR Experiences for Performance Support
DevLearn 2018 -  Designing AR Experiences for Performance SupportDevLearn 2018 -  Designing AR Experiences for Performance Support
DevLearn 2018 - Designing AR Experiences for Performance Support
 
Fitman webinar 2015 09-21 Generation and Transformation of Virtualized Assets...
Fitman webinar 2015 09-21 Generation and Transformation of Virtualized Assets...Fitman webinar 2015 09-21 Generation and Transformation of Virtualized Assets...
Fitman webinar 2015 09-21 Generation and Transformation of Virtualized Assets...
 
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018) Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
 
What's New in Java 8
What's New in Java 8What's New in Java 8
What's New in Java 8
 
JavaScript_III.pptx
JavaScript_III.pptxJavaScript_III.pptx
JavaScript_III.pptx
 

Recently uploaded

Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
21UME003TUSHARDEB
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
PKavitha10
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
Software Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.pptSoftware Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.ppt
TaghreedAltamimi
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
architagupta876
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
RamonNovais6
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
gowrishankartb2005
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Hematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood CountHematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood Count
shahdabdulbaset
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
Anant Corporation
 

Recently uploaded (20)

Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1CEC 352 - SATELLITE COMMUNICATION UNIT 1
CEC 352 - SATELLITE COMMUNICATION UNIT 1
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
Software Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.pptSoftware Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.ppt
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Hematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood CountHematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood Count
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
 

Javascript operators

  • 1. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 1 Operators in JavaScript
  • 2. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 2 Contents • Introduction to Operators • Various Categories of Operators • Usage of various Operators in Scripts
  • 3. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 3 Operators • An operator is used to transform one or more values into a single resultant value. • The value to which the operator is applied is referred as operands. • A combination of an operator and its operands is referred to as an expression.
  • 4. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 4 Arithmetic Comparison StringConditional Assignment
  • 5. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 5 Arithmetic Operators • Arithmetic operators are the most familiar operators because they are used every day to solve common math calculations + Addition - Subtraction * Multiplication / Division % Modulous (Remainder after division)
  • 6. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 6 Arithmetic Operators ++ increment operator _ _ decrement operator
  • 7. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 7 <html> <head> <title>Arithmetic Operators</title</head> <body> <script language="javascript"> a=20;b=3; document.write("sum="+(a+b)); document.write("<br> remainder="+(a%b)); document.write("<br> increment="+(++a)); document.write("<br> decrement="+(--b)); </script> </body> </html>
  • 8. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 8 Comparison Operators • Comparision operators are used to compare two values. == Equal != Not equal < = Less than or equal to >= Greater than or equal to ==== Strictly equal !== Strictly not equal
  • 9. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 9 Continued.. • The equal(==) and not equal to (!=) operators perform type casting for equality. For e.g. “5” == 5 evaluate to true. • The strictly equal(===) and strictly not equal to (!==) operators perform type casting for equality. For e.g. “5” === 5 evaluate to false.
  • 10. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 10 <html> <head><title>Comparison Operator</title> </head> <body> <script language="javascript"> document.write("[5>6]->" + (5>6)); document.write("<br>[10<=15]->" + (10<=15)); document.write("<br>[4==6]->" + (4==6)); document.write("<br>[7!=8]->"+(7!=8)); </script> </body> </html>
  • 11. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 11 String Operators • String operators are those operators that are used to perform operations on strings. • Currently, JavaScript supports only the string concatenation (+) operator. • This operator is used to join two strings. For e.g., “pq” + “ab” produces “pqab”.
  • 12. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 12 <html> <head><title>String Operator</title> </head> <body> <script language="javascript"> var c=3+5+"6"; var d=c; document.write("hello"+"world"); document.write("<br>"+ 3 + "6"); document.write("<br>"+ 3 + 5 +"6"); document.write("<br>result =" +d); </script> </body></html>
  • 13. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 13 Assignment Operators • The assignment operator is used to update the value of a variable. • Some assignment operators are combined with other operators to perform a computation on the value contained in a update the variable with the new value.
  • 14. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 14 Assignment Operators…. = sets the variable on the left of the = operator to the value of the expression on its right. += increments the variable on the left of the += operator of the expression on its right. -= decrements the variable on the left of the -= operator of the expression on its right.
  • 15. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 15 Assignment Operators…. *= multiplies the variable on the left of the *= operator to the value of the expression on its right. /= divides the variable on the left of the /= operator of the expression on its right.
  • 16. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 16 <html> <head><title>Assignment Operator </title></head> <body> <script language="javascript"> a=3; b=6; document.write("[a+=6]->"+(a+=6)); document.write("<br>[b*=5]->"+(b*=5)); </script> </body> </html>
  • 17. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 17 Conditional Operators • JavaScript supports the conditional expression operator. • They are ? And : • The conditional expression operator is a ternary operator since it takes three operands, a condition to be evaluated and two alternative values to be returned based on truth and falsity of a condition
  • 18. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 18 Conditional Operators…. Syntax: Condition ? Value1:value2 The condition expressed must return a value true or false. If the condition is true, value 1 is the result of the expression, otherwise value 2 is the result of the expression
  • 19. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 19 <html> <head><title>Conditional Operator </title></head> <body> <script language="javascript"> a=8;b=6; c=a>b?a:b; document.write(c+"is greater"); </script> </body> </html>
  • 20. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 20
  • 21. 7/20/2015 Presented by:- Ms. Deepti Tara, Assoc. Prof., UIC, CU 21