forked from yoyoman21/Javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment5.html
More file actions
35 lines (31 loc) · 1.28 KB
/
Assignment5.html
File metadata and controls
35 lines (31 loc) · 1.28 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
<html>
<head>
<title>Javascript</title>
<h1>Assignment5</h1>
</head>
<body>
<script>
document.write("1.var:-Keyword used for declration of a variable.It can be declared anywhere in codei.e it is a global variable.var is a function scoped");
document.write("<br/>e.g:-");
var a,b,c;
a=6;
b=5;
c=a+b;
document.write("<br/>",c);
document.write("<br/>2.let:-It is used to set the scope of variable.let is a block scoped and it is a local variable.Not compulsory to initialise during declaration."); document.write("<br/>e.g:-");
document.write("<br/> e.g");
var name="vighnesh";
{
let name="sahil";
document.write("<br/>",name);
}
document.write("<br/>3.const:-const means constant variable.The value is fixed and cannot be changed.The value should be given initialisation.It cannnot change the elements of array but the can push the elements in array");
document.write("<br/>e.g:-");
const x=5;
document.write("<br/>",5);
/* const no=['one','Two','Three'];
no.push('four');
document.write("<br/>",no);*/
</script>
</body>
</html>