-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcart-quantity.html
More file actions
51 lines (39 loc) · 1.02 KB
/
Copy pathcart-quantity.html
File metadata and controls
51 lines (39 loc) · 1.02 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>variables</title>
<style>
</style>
</head>
<body>
<h2>cart quantity</h2>
<button onclick="
console.log(`cart quantity: ${CartQuantity}`);
">Show Quantity</button>
<button onclick="
CartQuantity = CartQuantity + 1;
// you can also do it like these instead of above for shorting.
// CartQuantity += 1;
// CartQuantity++;
console.log(`cart quantity: ${CartQuantity}`);
">Add to Cart</button>
<button onclick="
CartQuantity = CartQuantity + 2;
console.log(`cart quantity: ${CartQuantity}`);
">+2</button>
<button onclick="
CartQuantity = CartQuantity + 3;
console.log(`cart quantity: ${CartQuantity}`);
">+3</button>
<button onclick="
CartQuantity = 0;
console.log(`cart was Reset`);
console.log(`cart quantity: ${CartQuantity}`);
">Reset Quantity</button>
<script>
let CartQuantity = 0;
</script>
</body>
</html>