html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Score Updater</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<section class="preview"></section>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
p {
color: purple;
margin: 0.5em 0;
}
* {
box-sizing: border-box;
}
Enter to Rename, Shift+Enter to Preview
js
js
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
window.onload = function () {
let response;
let score = 98;
let machineActive = true;
if(machineActive) {
if(score < 0 || score > 100) {
response = 'This is not possible, an error has occured.';
} else if(score <= 19) {
response = 'That was a terrible score — total fail!';
} else if(score <= 39) {
response = 'You know some things, but it\'s a pretty bad score. Needs improvement';
} else if(score <= 69) {
response = 'You did a passable job, not bad!';
} else if(score <= 89) {
response = 'That\'s a great score, you really know your stuff';
} else if(score <= 100) {
response = 'What an amazing score! Did you cheat? Are you for real?';
}
} else {
response = 'The machine is turned off. Turn it on to process your score.';
}
let section = document.querySelector(".preview");
section.innerHTML = ' ';
let para1 = document.createElement('p');
let para2 = document.createElement('p');
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run