Skip to content

Commit e1e4331

Browse files
Jace MitsukaJace Mitsuka
authored andcommitted
answers 1&2
1 parent 64c1977 commit e1e4331

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

exercises.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ If/else statements = Evaluates (or checks) a condition. If the condition is true
2828
*
2929
* The function will return true if the number passed into the function is equal to or greater than Hawaii's voting age. Console.log your result.
3030
*/
31-
31+
function canVote(age){
32+
if(age>=18){
33+
return "true"
34+
}else{
35+
return "false"
36+
}
37+
}
38+
var votingAge = canVote(18);
39+
console.log(votingAge);
3240

3341
/*
3442
* #2
@@ -41,7 +49,15 @@ If/else statements = Evaluates (or checks) a condition. If the condition is true
4149
* The function will return the message: "Login Success!", if the string passed into the function is "test1234"
4250
* Console.log your result.
4351
*/
44-
52+
function login(password){
53+
if(password === "test1234"){
54+
return "Login Success!"
55+
}else{
56+
return "get out!"
57+
}
58+
}
59+
var kenny = login("test124")
60+
console.log(kenny);
4561

4662
/*
4763
* #3

0 commit comments

Comments
 (0)