-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariable.html
More file actions
53 lines (44 loc) · 1.7 KB
/
variable.html
File metadata and controls
53 lines (44 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Learning JavaScript</title>
</head>
<body>
<center><h1>Variables </h1></center>
<h3>Data types to remeber when assigning thr Variable:</h3>
<ol>
<li>Number: Floating point numbers, for decimals and integers</li>
<li>String: Sequence of characters, used for text</li>
<li>Boolean: Logical data type that can be true or false</li>
<li>Undefined: Data type of a variable that does not have yet</li>
<li>Undefined: Data type of a variable that does not have yet</li>
<li>Null: Also means 'non-existent</li>
</ol>
<h3>Rules to choose Variable</h3>
<ol>
<li>Names can contain letters, digits, underscores, and dollar signs</li>
<li>Names must begin with a letter</li>
<li>Names can also begin with $ and _ (but we will not use it in this tutorial)</li>
<li>Names are case sensitive (y and Y are different variables)</li>
<li>Reserved words (like JavaScript keywords) cannot be used as names</li>
</ol>
<center><h3>Example of Assiging Variables </h3></center>
<p>var firstName = 'Roopak';
<br />
var lastName = 'Kumar';
<br />
var age = 26;
<br />
var job = 'Student'
<br />
var fullName = (firstName +' '+ lastName);
<br />
console.log('My name is ' + fullName + ' and I am ' + age + ' years old and I am a ' + job);</p>
<form action="result.html">
<input type="submit" name="Check" value="Check">
<p>click 'Check' to see the answer</p>
</form>
</body>
<script src="variable.js"></script>
</html>