There are many types of operators:
1-To assign variable we use =
, for example:
var x=1 ;
.
2-Arithmatic operators: (+,-,*,/,++,--
) and they can be used as follows:
x=5+5 ;
++x=11;
--x=9;
3-String operators: they are the same as arithmatic operators but they are used for adding for example two strings together:
x="H" + "i" = Hi ;
4-Comparsion Operators: (<,>,=,<=,=>,!=
) : from their name they are used for comparing two inputs:
x=5\<1 ;
5-Logical Operators: (&&
“and”,||
“or”,!
“not”)
For more detailed information, check the image under
The command fucntion is used for calling series of commands by typing the name of the function, which makes the whole JS page more readable and easier to apply edits to.
function syntax:
Setting function can be done as follows:
function "the name of the function" ("argument"){
"series of commands"*;
}
Calling function can be done as follows:
"the name of the function"("argument);