-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBooleans.html
More file actions
43 lines (38 loc) · 1022 Bytes
/
Booleans.html
File metadata and controls
43 lines (38 loc) · 1022 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
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html>
<head>
<title>Evaluate Conditions</title>
</head>
<body>
<h2>Condition Evaluator</h2>
<button onclick="showResult()">Evaluate</button>
<p id="result"></p>
<script>
function evaluateconditions(obj1) {
let result = "";
if (obj1.age >= 18 || obj1.hasLicense === true) {
result += "Eligible to drive\n";
}
if (obj1.temperature > 30 || obj1.humidity > 70) {
result += "Warning: High discomfort level\n";
}
if ((obj1.role === "admin" || obj1.role === "editor") || obj1.isActive === true) {
result += "Access granted\n";
}
return result.trim();
}
const obj1 = {
age: 20,
hasLicense: true,
temperature: 32,
humidity: 60,
role: "admin",
isActive: true,
};
function showResult() {
const result = evaluateconditions(obj1);
document.getElementById("result").innerText = result;
}
</script>
</body>
</html>