A variable is a container for storing data or values.
*Please note that it displays as the order we code.
Example
var x; → let's declare the variable as x.
x=17; → and we start to store value into the variable.
alert(x);
x="value";
alert(x);
var y=true;
Operators is like math formulas, consisting of various characters.
Let’s explain the formulas and terms by examples...
When we write
3+5; → Arithmetic operators
alert(3+5);
=> The result is 8.
var result=3*5; → Assignment operators
alert(result);
=> The result is 15.
Follow the last operator
result++; → increment (++) operators. It means the result has to plus 1, which can also be written as “result+1;”
alert(result);
=> The result is 16.
4<3; → Comparison operators.
result=4<3;
alert(result);
=> The boolean is “true.” If we write 4<3
, the boolean is “false.”
var data=3;
result=data*data;
alert(result);
=> The result is 9.
alert(data);
=> The result is 3.
Feel free to comment and share your ideas below to learn together!
If you guys find this article helpful, please kindly do the writer a favor — LIKE this article.