-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday1.html
More file actions
32 lines (29 loc) · 898 Bytes
/
Copy pathday1.html
File metadata and controls
32 lines (29 loc) · 898 Bytes
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
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
</head>
<body>
<script>
const rollno = 10;
let name = 'Jessica';
let n1 = 100;
let n2 = 200;
// Method 1
console.log("JavaScript");
console.log("Roll No: " + rollno + "\nName: " + name);
console.log("n1 = " + n1 + ", n2 = " + n2);
console.log("Sum = " + (n1 + n2));
// Method 2
let statement = "Sum of " + n1 + " and " + n2 + " is " + (n1 + n2);
console.log(statement);
// Using Backtick(`) (Effective method)
// case 1
let statement_1 = `Sum of ${n1} and ${n2} is ${n1 + n2}`;
console.log(statement_1);
// case 2
console.log(`Sum of ${n1} and ${n2} is ${n1 + n2}`);
console.log(`Roll no: ${rollno}, Name: ${name}`);
</script>
</body>
</html>