CHAPTER - 7

JAVASCRIPT OPERATORS

Operators in JavaScript are very similar to operators that appear in other programming languages. The definition of an operator is a symbol that is used to perform an operation. Most often these operations are arithmetic (addition, subtraction, etc.), but not always.

Javascript arithmetic operator chart

Operator

English

Example

+

Addition

2+2=4

-

Subtraction

4-2=2

*

Multiplication

2*2=4

/

Division

2/2=0

%

Modulo

3%2=1


COMPARISON OPERATORS



Operator

English

Example

Result

==

Equal

x==y

true

!=

Not Equal

x!=y

false

<

Less than

x<y

true

>

Greater than

x>y

false

<=

Less than equals to

x<=y

true

>=

Greater than equal to

x>=y

false






SIMPLE PROGRAM

<!DOCTYPE html>

<html>

<body>

<h1>FIRST JAVASCRIPT PAGE</h1>

<script>

document.write("<p>My First JavaScript</p>");

</script>

</body>

</html>

LOGICAL OPERATORS

Operator

English

Example

&&

AND

(x < 10 && y > 1) is true

||

OR

(x==5 || y==5) is false

!

NOT

!(x==y) is true

Comments

Popular posts from this blog

CHAPTER - 14

CHAPTER - 18