-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2. Variables integration.html
More file actions
65 lines (52 loc) · 1.55 KB
/
Copy path2. Variables integration.html
File metadata and controls
65 lines (52 loc) · 1.55 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
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html>
<head>
<title>JS Variables State</title>
<style>
body {
font-family: monospace;
padding: 30px;
line-height: 1.6;
}
button {
padding: 8px 16px;
cursor: pointer;
margin-bottom: 20px;
background: #ddd;
border: 1px solid #000;
}
#output {
border-left: 3px solid #333;
padding-left: 15px;
}
.change {
color: #d946ef;
font-weight: bold;
}
</style>
</head>
<body>
<h2>Variable Reassignment</h2>
<button onclick="showVars()">Update Wallet</button>
<div id="output">
<i>Results will appear here...</i>
</div>
<script>
function showVars() {
// Constant value (cannot change)
const userName = "Sandeep";
// Initial value
let wallet = 10000;
let initialWallet = wallet; // Storing the original value to show you the difference
// Reassignment (The change)
wallet = wallet - 3000;
document.getElementById("output").innerHTML = `
<b>Name:</b> ${userName} (const)<br>
<b>Original Wallet:</b> ₹${initialWallet}<br>
<span class="change">Spent: ₹3000</span><br>
<b>Current Wallet:</b> ₹${wallet} (let)
`;
}
</script>
</body>
</html>