58 lines
1.6 KiB
HTML
58 lines
1.6 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<meta name="viewport" content="width=device-width">
|
||
|
<title>repl.it</title>
|
||
|
<link href="style.css" rel="stylesheet" type="text/css" />
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<p>Be sure to enable the "developer" tools! (It's the wrench icon in replit)</p>
|
||
|
<script src="script.js"></script>
|
||
|
|
||
|
<script>
|
||
|
// Don't worry about this code here, just checking your results :)
|
||
|
// I get it, you're curious,
|
||
|
// but it's OK if you don't understand what's going on in here, you'll learn it in time.
|
||
|
|
||
|
let numCorrect = 0;
|
||
|
let numChecked = 0;
|
||
|
|
||
|
const result = numberChecker();
|
||
|
console.log(`You entered: ${number}, and got result: ${result}`);
|
||
|
console.log("\n\n\n Test Results: \n")
|
||
|
|
||
|
function checkNumberChecker(num) {
|
||
|
number = num;
|
||
|
const result = numberChecker();
|
||
|
if ((result === true && number >= 10) ||
|
||
|
(result === false && number < 10)) {
|
||
|
numCorrect++;
|
||
|
console.log(`If I enter ${number}, the result is ${result}. This is correct!`);
|
||
|
} else {
|
||
|
console.error(`I entered "${number}", and got "${result}" as a result, I should have gotten "${number >= 10}" instead`);
|
||
|
}
|
||
|
|
||
|
numChecked++
|
||
|
console.log("\n");
|
||
|
}
|
||
|
|
||
|
checkNumberChecker(2)
|
||
|
checkNumberChecker(12)
|
||
|
checkNumberChecker(6)
|
||
|
checkNumberChecker(10)
|
||
|
checkNumberChecker(9)
|
||
|
|
||
|
if (numCorrect === numChecked) {
|
||
|
console.log("You've passed all the tests, continue to the next exercise!")
|
||
|
} else {
|
||
|
console.log(`You have failed ${numChecked - numCorrect} out of ${numChecked}, please try again`);
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
</body>
|
||
|
|
||
|
</html>
|