Module 5 JavaScript Operators. CS346 Javascript-52 Examples  JS-5 Examples.

Slides:



Advertisements
Similar presentations
Operators and Expressions Operators are symbols that produce a result based on some rules. Examples: +, -, =, > and
Advertisements

Chapter 2: Java Fundamentals Operators. Introduction to OOP Dr. S. GANNOUNI & Dr. A. TOUIR Page 2 Content Group of Operators Arithmetic Operators Assignment.
CS 3850 Lecture 5 Operators. 5.1 Binary Arithmetic Operators Binary arithmetic operators operate on two operands. Register and net (wire) operands are.
C expressions (Reek, Ch. 5) 1CS 3090: Safety Critical Programming in C.
Tutorial 11 Working with Operators and Expressions
Primitive Types Java supports two kinds of types of values – objects, and – values of primitive data types variables store – either references to objects.
More about Numerical Computation CS-2301, B-Term More about Numerical Computation CS-2301, System Programming for Non-Majors (Slides include materials.
JavaScript, Third Edition
1 MATERI PENDUKUNG OPERATOR Matakuliah: M0074/PROGRAMMING II Tahun: 2005 Versi: 1/0.
Compunet Corporation1 Programming with Visual Basic.NET Arithmetic, Logical & Bitwise Operators Week # 3 Tariq Ibn Aziz.
C++ Operators CS242 COMPUTER PROGRAMMING T.Banan Al-Hadlaq.
JavaScript Events and Event Handlers 1 An event is an action that occurs within a Web browser or Web document. An event handler is a statement that tells.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Data Types and Operators (NON Audio Version) © Dr. David C. Gibbs
Chapter 4: Operators Department of Computer Science Foundation Year Program Umm Alqura University, Makkah Computer Programming Skills /1436.
Exercises A-Declare a variable of double type with initial value=0.0; B- Declare a constant of String type with initial value=“Good” C- Declare a variable.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Expression.
2440: 211 Interactive Web Programming Expressions & Operators.
Chapter 3: Data Types and Operators JavaScript - Introductory.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Operators Using Java operators An operator takes one or more arguments and produces a new value. All operators produce a value from their.
CSC 270 – Survey of Programming Languages C Lecture 5 – Bitwise Operations and Operations Miscellany.
April 6, 1998CS102-02Lecture 2-1 Java Operators CS Lecture 2-1 Being a Smooth Operator.
Bitwise Operators in C. Bitwise operators are used to manipulate one or more bits from integral operands like char, int, short, long.
C++ Basics Tutorial 6 Operators. What are going to see today? Assignment operator(=) Arithmetic operators(+,-,*,/,%) Compound assignment(+=,-=,*=……..)
Operators. Today’s Learning Goals … Understand the purpose of JavaScript operators Explore the mathematical operators Find out about the assignment operators.
C Operators. CONTENTS C OPERATORS TYPES OF OPERATOR UNARY BINARY TERNARY ARITHMATIC RELATIONAL LOGICAL.
4.1 Object Operations operators Dot (. ) and new operate on objects The assignment operator ( = ) Arithmetic operators + - * / % Unary operators.
Operators Precedence - Operators with the highest precedence will be executed first. Page 54 of the book and Appendix B list C's operator precedence. Parenthesis.
1 Operators and Expressions. Expressions Combination of Operators and Operands Example 2 * y + 5 Operands Operators.
Sahar Mosleh California State University San MarcosPage 1 Data Types and Operators.
Operators in JAVA. Operator An operator is a symbol that operates on one or more arguments to produce a result. Java provides a rich set of operators.
CS 151: Digital Design Chapter 4: Arithmetic Functions and Circuits
Doing math In java.
OPERATORS Chapter2:part2. Operators Operators are special symbols used for: mathematical functions assignment statements logical comparisons Examples.
A: A: double “4” A: “34” 4.
Chapter 14 JavaScript: Part II The Web Warrior Guide to Web Design Technologies.
Operators.
Department of Electronic & Electrical Engineering Expressions operators operands precedence associativity types.
ECE 103 Engineering Programming Chapter 4 Operators Herbert G. Mayer, PSU CS Status 6/19/2015 Initial content copied verbatim from ECE 103 material developed.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
CHAPTER 2 PART #4 OPERATOR 1 st semester King Saud University College of Applied studies and Community Service Csc
OPERATORS IN C CHAPTER 3. Expressions can be built up from literals, variables and operators. The operators define how the variables and literals in the.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Rational Expressions relational operators logical operators order of precedence.
ECE 103 Engineering Programming Chapter 4 Operators Herbert G. Mayer, PSU Status 6/10/2016 Initial content copied verbatim from ECE 103 material developed.
Introduction to Calculated Columns Variables, Conditionals, and String Manipulation PRESENTER: Cameron Blashka| Informer Implementation Specialist| April.
Operators and Expressions
University of Central Florida COP 3330 Object Oriented Programming
2.0 FUNDAMENTALS OF JAVA PROGRAMMING LANGUAGE
Operators Operators are symbols such as + (addition), - (subtraction), and * (multiplication). Operators do something with values. $foo = 25; $foo – 15;
University of Central Florida COP 3330 Object Oriented Programming
Expressions An expression is a portion of a C++ statement that performs an evaluation of some kind Generally requires that a computation or data manipulation.
Expressions and Control Flow in JavaScript
By: Muhammad Zidny Naf’an
Operators and Expressions
JavaScript and Ajax (Expression and Operators)
Chapter 8 JavaScript: Control Statements, Part 2
With Assignment Operator
C Operators, Operands, Expressions & Statements
Introduction to Programming – 4 Operators
Chapter 2: Java Fundamentals
JavaScript CS 4640 Programming Languages for Web Applications
Operators In Java Programming By Rajanikanth B.
Herbert G. Mayer, PSU CS Status 7/19/2015
ENERGY 211 / CME 211 Lecture 5 October 1, 2008.
OPERATORS in C Programming
Expressions and Assignment Statements
OPERATORS in C Programming
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

Module 5 JavaScript Operators

CS346 Javascript-52 Examples  JS-5 Examples

CS346 Javascript-53 Expressions  Expression — combination of literal values, variables, and operators that can be evaluated by JavaScript to produce a result  Operands — variables and literals contained in an expression  Operators — symbols used in expressions to manipulate operands Performs some sort of calculation, comparison, or assignment on one or more values

CS346 Javascript-54 Operators  Arithmetic: + - * / % (int remainder)  Increment:++ ++var — Value Incremented Immediately var count = 1; var newCount = ++count; // newCount = 2 var++ — Value Incremented After Line var count = 1; var newCount = count ++; // newCount = 1  Decrement: - - Similar to increment

CS346 Javascript-55 Operators  Assignment: = += -= *= /= %= var x=1, y=2; x += y; // x = 3  Comparison: == != > = <= Results in True or False var x=1, y=2; x == y; // returns False  Logical: && || ! Results in True or False var x=1, y=2; var returnVal = x==1 || y==5; // returns True

CS346 Javascript-56 Operators  Negation: -  Bitwise: logical operators that work at the bit level (ones and zeros) AND & XOR ^ OR | NOT - Left Shift << Right Shift >> Right Shift (Zero Fill) >>>

CS346 Javascript-57 Operators  String + Concatenate var x=“You age is”, y=18; var newStr = x + y; document.write(newStr); // returns Your age is18 document.write(x + “ ” + y + “.”); // returns Your age is 18.  Conditional: boolean? exprT:exprF document.write(“The fee is ”+ (isMem ? “$5” : “$10”));

Beware  Variable type is dynamic  Examples 5-1AssignmentExamples.htm  Combination of CSS and Javascript  Generation of well-formed html document 5-2ComparisonExamples.htm 5-3LogicalExamples.htm