According to javascript.com, Operators are the symbols between values that allow different operations like addition, subtraction, multiplication, and more.
There are ten operators in Javascript
+ (The Arithmetic operator)
- (The Subtraction operator)
= (The Assignment operator transfers values. In other words, it assigns the value on the right to the value on the left eg var room_number = 3; this means that this 3 has been assigned into that variable)
== (The “Equivalent to” operator)
=== (The Strict comparison. This means that it should not just check to know if it is equal but also to check if they are of the same type)
% (Modulus. This checks when a number is even.)
> (The Greater Than operator)
< (The Lesser Than operator)
/ (Division Operator)
>= (The Greater or Equal operator)
<= (The Lesser or Equal operator)
Javascript statements are formed with operands and operators and this eventually resolves to a value.
These are javascript statements
1+2
(2*3) + (6*5)
x =62
The values in the statements are the operands while the symbols between the values are the operators.
To get the value of 1 + 2:
Assign a name to both operands. E.g. “Addition”
Then, document.write which runs the operation. If the operation is successful, it will appear on the webpage.
var addition = 1 + 2;
document.write (addition);
On your webpage, your answer will be displayed as '3'
No comments:
Post a Comment