-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
66 lines (54 loc) · 1.76 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<title>My JavaScript Test</title>
</head>
<body>
<h1 id="page-header">
Loading...
</h1>
<script type="text/javascript">
var myName = "Joshua"
var header = document.getElementById("page-header")
// concatenation
header.innerHTML = myName + " is cool."
// interpolation
var numberString = "75"
var numberNumber = 75
var booleanValue = false
var myObject = {}
// $.post('http://mysite.com/api/createThing')
var response = {
"version": "1.0.0",
"packageName": "myTestData"
}
console.log('The server is running version: ' + response.version)
console.log('This is SPARTA!!!')
var numberCorrect = 0
var answer1 = prompt('Is JavaScript a cool language? [y/n]')
var correctAnswer1 = 'y'
if (answer1 == correctAnswer1) {
// numberCorrect = numberCorrect + 1
numberCorrect += 1
// numberCorrect++
// ++numberCorrect
} else {
console.warn('The correct answer is [y].')
}
var answer2 = prompt('Can a JavaScript variable name start with \'-\'? [y/n]')
var correctAnswer2 = 'n'
if (answer2 == correctAnswer2) {
numberCorrect += 1;
} else {
console.warn('The correct answer is [n].')
}
var score = numberCorrect / 2 * 100
alert(`Your score is ${score}%.`)
var newVar
newVar = 7
newVar = 'hi'
newVar = null
header.innerHTML = `The type of newVar is: ${typeof newVar}`
</script>
</body>
</html>