Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
2

How to solve this?

rudy35hernandez
rudy35hernandez

I am stumped on this question. I re-read the entire lesson plan and I am still unable to solve this. Any ideas?

function lottoTicket(age) {
const valid = "Thanks for your purchase!"
const invalid = "Purchase denied. Try again when you're older."
if(age > 18) {
return(valid)
}
else {
return(invalid)
}
}

ageAlice = 12

ageBob = 20

// declare a variable to save Alice's lottoTicket autoresponse and another to save Bob's lottoTicket autoresponse

2 years ago
You are viewing a single comment. View All
1
rudy35hernandez
rudy35hernandez

@SixBeeps
So I removed ageAlice = 12 altogether to try to solve one at a time since i can't seem to get both. I added "lottoTicket('Bob') under the ageBob = 20, and "I'm still getting purchase denied. Try again when you're older."
I also tried "console.log(lottoTicket('Bob'));" and I still got the purchase was denied message.

2 years ago