Arithmetic Operator Arithmetic operators are binary operators, as they perform basic arithmetic operator on two operand.
Increment and decrement operators The increment operator (++) increases the value by 1, while the decrement operator(--) decreases the value by 1.
Relational Operators Relational operators are binary operators that make compare between two operands. They return a boolean value namely, true or false.
Logical Operators Logical operators are binary operators that perform logical operations on two operands.
Assignment Operators Assignmentoperator performs operations between the twooperands and assign the result to its left operand.
Bitwise OperatorsBitwise operators perform operations on the correspondingindividual bits of two operands.
String OperatorsCan merge two string values that are assigned totwo different variables. Operator Descriptin Example + Concatenates two or var fullname=‘John’ + ‘ ’ + more strings into a ‘Blake’; single string fullname=‘John Blake’ += Concatenates to or var flower=‘Rose’; (Add-By-Value) more strings and flower +=‘’ + ‘flower’; assign the result to its flower =‘Rose Flower’; left operant
Shift OperatorsShift operators are binary bitwise operators that perform shift operations onbits. The first operand is the decimal number on which the shift operation isperformed. The second operand specifies the number or bit positions bywhich the bits are to be shifted. Operator Description Example << Shift the bit positions 8<<2 yield 32,because 00001000 (Left Shift towards the left by shifting shifted by 2 bits becomes Operator) the number of bits in the 00100000,which is 32. Here, the left at the right two leftmost bits are placed toward the right >> Shift the bit positions 8>>2 yield 32,because 00001000 (Right Shift towards the right by shifting shifted by 2 bits becomes Operator) the number of bits in the 00000010,which is 2. Here, the right at the left two rightmost bits are placed toward the left.
The “if” StatementThe if statement executes a block ofstatements based on a logical booleancondition.
The “if-else” StatementThe if statement specifies a block ofstatement to be executed when thecondition in the if statement is true, andit’s requires to define a block ofstatements to be executed when aconditions evaluated to false
The “if-else if ” StatementThe if-else if statements allow youto check multiple conditions andspecify a different block to beexecute for each condition.
Nested “if” StatementThe nested if statements comprises ofmultiple if statements within an ifstatement.
“Switch-case” StatementTo simplify the coding and avoid using multiple ifstatement, switch-case statement can be used as adifferent approach to code the same logic
Regular Expressions A regular expression is a pattern, whose purpose is to help invalidating the text format Example:
TypesCharacter or symbols allow matching a substring that exists ata specific position within a string.
TypesCharacters or symbols are combined to form character classes forspecifying patterns.
SummaryThe & operator perform bitwise AND operation andreturns the result to the operand on the left hand sideThe | operator performs bitwise OR operation andreturns the result to the operand on the left hand sideThe ^ operator performs bitwise XOR operation andreturns the result to the operand on the left hand sideThe string concatenation operator combine differentstrings into single string.
Summary… The left shift operator shifts the bits on the leftmost side toward the right. The right shift operator shifts the bits on the rightmost side toward the left. Nested switch-case construct refers to including a switch-case construct within a case block. Building Dynamic Websites/Session 1/ 23 of 16