Skip to content

Commit 91b22a2

Browse files
committed
password checker variable scope
1 parent 3b45f5d commit 91b22a2

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
// Already have the password stored in a variable
2-
const password = "Mattcarolus10"
1+
// Already have the password stored in a variable;
2+
const password = "Mattcarolus10";
33

4-
// Receive the value which the user entered
4+
// Receive the value which the user entered;
55
function checkPassword(userInput) {
66

7-
// Compare the two values
7+
// Compare the two values;
88
if (userInput===password) {
99

10-
// If they match print "Correct password entered"
11-
console.log("Correct password entered ")
10+
// If they match print "Correct password entered";
11+
response = "Correct password entered "
1212
}
1313

1414
else {
15-
// If they don't match print "Incorrect password, please try again"
16-
console.log("Incorrect password, please try again")
17-
}
15+
// If they don't match print "Incorrect password, please try again";
16+
response = "Incorrect password, please try again"
17+
};
1818

19-
}
20-
checkPassword("Mattcarolus")
19+
};
20+
checkPassword("Mattcarolus10");
21+
console.log(response)

0 commit comments

Comments
 (0)