Previously, you have learned about Javascript. This time we are going to explain you about "Variables in Javascript".
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigPbspqeW_FOEXdIzHzBKgFHDtZStmZGS34uNudOX4JxVgMs6z0JtX91lYZuqd5ogorUXcS71PnBrS-dxCVP2-XYok_1AIjgEK_Bb2oG200DYH3xN25lMsGM9oFwedVl6er20ptD1okT7G/s640/JS.jpg)
If you are going to make a program in Javascript and you want to add some data, you don't need to choose the data type before you make the program. In Javascript, data type has been added automatically so you don't need to add the variable to make a program.
example
in pascal or C programming if you want print out string and numeric on the screen you must choose type data first
example Pascal
in pascal or C programming if you want print out string and numeric on the screen you must choose type data first
example Pascal
JavaScript have a different way to set a type data, JavaScript will automatically set the type data depend on data what you write in script
example Java Script
this script will print out the value from variable Text and Number without set type data
just write Var (your variable name);
JavaScript
Math Operator
+ | Addition | 2 + 2 = 4 |
---|---|---|
- | Substraction | 2 - 2 = 0 |
* | Multiplycation | 2 * 2 = 4 |
/ | Division | 2 / 2 = 1 |
% | Modulus | 2 % 2 = 0 |
++ | Increment | var A=10; A++ now is 11 |
-- | Decrement | var B=10; B-- now is 9 |
this is example javascript of math operator use,
you can try at http://codepen.io/pen/
Conclusion
if you want add some variable on JavaScript you don't need to worry about what the type data will you use you just need to write (var text="Hello" ) to print string and (var age=27) to print age number and you must know about write type you want use string you must add " " to the variable and don't forget to fill the ;
keep reading and cheers.
edankeun.com
Learn Javascript Part II (Variable & TypeData)
4/
5
Oleh
DOWNLOAD YOUR GAME