-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCh7Lab
More file actions
71 lines (62 loc) · 1.35 KB
/
Ch7Lab
File metadata and controls
71 lines (62 loc) · 1.35 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
66
67
68
69
70
71
<!--Jeanine Rioux -->
<!--CSC 14A 10/15/18 -->
<!--Lab Ch7 Lie Detector -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Lie Detector Test</title>
</head>
<body>
</body>
<script>
function lieDetectorTest()
{
var lies = 0;
var stolenDiamond = {};
if(stolenDiamond)
{
console.log("You stole the diamond");
lies++;
}// end if stolen Diamond
var car = {
keysInPocket: null
};
if (car.keysInPocket)
{
console.log("Uh oh, guess you stole the car!");
lies++;
}// end if keys in pocket
if (car.emptyGasTank)
{
console.log("You drove the car after you stole it!");
lies++;
}// end if empty gas tank
var foundYouAtTheCrimeScene = [];
if (foundYouAtTheCrimeScene)
{
console.log("A sure sign of guilt!");
lies++;
}//end if found at crime scene
if (foundYouAtTheCrimeScene[0])
{
console.log("Caught with a stolen item!");
lies++;
}//end if caught a crime scene element 0
var yourName = " ";
if (yourName)
{
console.log("Guess you lied about your name!");
lies++;
}// end if your name
return lies;
}// end function liedetectortest
var numberOfLies = lieDetectorTest();
console.log("You told " + numberOfLies + " lies!");
if (numberOfLies >= 3)
{
console.log("Guilty as charged!!");
}// end if num lies >3
</script>
</body>
</html>