Get Programming with JavaScript - Listing 12.01
Listing 12.01 - Guess the number
var secret = 8;
var guess = function (userNumber) {
if (userNumber === secret) {
console.log("Well done!");
}
};
Further Adventures
Listing 12.01 - Guess the number - Tasks 4 & 5
- Change the condition in parentheses to now check if the guess is greater than the secret.
- Change the message logged to "Too high!"
var secret = 8;
var guess = function (userNumber) {
if (userNumber > secret) {
console.log("Too high!");
}
};