Hello there. I'm going through the most basic things after the introduction to Javascript. In this article I will discuss the variables in Javascript .I think you know what the variable is, and I go directly to definitions.
1) In Javascript, variables are defined as var .
For example;
Code:
var degisken; var ad="Mehmet"; var yas=33;
2) In Javascript, the type of the variable is not specified . That does not include expressions like int, string, double . Only the variable name and the value are written.
3) In Javascript, each line ends with a semicolon .
4) to the variable a variable is different. There is a distinction between uppercase and lowercase. (case sensitive)
5) Variable names cannot start with numbers .
6) Even if you type a letter in Javascript incorrectly, something may not appear on your page. So it is difficult to find when there are errors.
7) Description lines // done with or / * ... * / between written.
Now let's continue with the examples.
javascript variables
We have defined 3 variables here and we have written them with document.write () . We combined them with the + operator.
Screenshot :
javascript variables
Now let's define multiple variables and do operations on them.
javascript variables
Here we have defined 6 variables and printed on 3 screens. We left a space in between . We did this with the space drop tag in html. We have also seen how to use the description lines.