TweetFacebookShareThis

JavaScript Basics Part 3

Previous Page    Next Page

Operators

Computer Studies javascript_logo

Operators are words or symbols in JavaScript expressions that perform on one or two values to get another value, operators perform actions called operands, expressions often contain operators and can work on variable values, Comparison operators are used to compare two values, assignment, Connubial, Boolean, Bitwise, Object and Misc.

Comparison Operators Description
= = Returns true if the values compared are equal
! = Returns true if the values compared are not equal
> Returns true if the first value compared is greater than the second one
> = Returns true if the first value compared is greater than or equal to the second one
< Returns true if the first value compared is less than the second one
< = Returns true if the first value compared is less than or equal to the second one
Assignment Operators 
= Assign the value of the right-hand operand to the variable on the left
+ =, - =, * =, / =) Add/Minus/Multiply/Divide the value of the right-hand operand to the left-hand variable and stores the result in the left-hand variable
& =, | = Assigns result of(left-hand operand && / || right-hand operand) to left-hand operand
Connubial Operators 
+ Adds two strings or numbers
- Subtracts two numbers Negates a numerical value
* Multiplies two numbers
/ Divides two numbers
Boolean Operators 
&& AND operator returns true if the values compared are both true Example: x && y
|| OR operator returns true if either of the values compared are true Example: x || y
! NOT operator returns the opposite of a Boolean value Example: !x

Keywords and reserved words

Keywords are used by the JavaScript engine and cannot be used as objects, variable names, function names or methods; some keywords have been reserved for future use and are not presently interpreted.

abstract do implements protected typeof
as double import public use
boolean else in return var
break enum instanceof short void
byte export int static volatile
case extends interface super while
catch false is switch with
char final long synchronized  
class finally namespace this  
continue float native throw  
const for new throws  
debugger function null translent  
default goto package true  
delete if private try  

Some JavaScript Tutorials
www.w3schools.com
www.javascriptkit.com

Previous Page    Next Page

Recommended Books