Frontend Development

JavaScript Lessons 2: Variables

Submitted by BURST, , Thread ID: 109613

Thread Closed
15-12-2018, 09:18 PM
#1
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.
[Image: kod1-300x191.png]
javascript variables

We have defined 3 variables here and we have written them with document.write () . We combined them with the + operator.

Screenshot :
[Image: site1.png]
javascript variables

Now let's define multiple variables and do operations on them.
[Image: kod11-300x198.png]
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.

Screenshot :
[Image: site11.png]
[Image: e72398fe92beda2aa80d0329e8b9f4febece7568.gif]

Users browsing this thread: 1 Guest(s)