Age calculator app

Solution retrospective
- Should hoisting be strictly recommended on this project?
- What would this below code return 👇
console.log(str) var str = 'hello world'
- In what area is a Switch statement needed?
Please log in to post a comment
Log in with GitHubCommunity feedback
- @kevbradwick
Hello. Well done on your solution! Check the mobile view - the rounded corners are missing though.
I would avoid variable hoisting as it can introduce unintuitive bugs. Your code snippet should print
undefined
- the variable was declared but not assigned. The switch statement is an alternative toif/else
. Personally I would only use switch statements when I need to make simple assignments, usually one liners. In some languages, there are claims that switch statements are quicker to execute but I have rarely seen that in practice and normally see them as a style preference.Marked as helpful
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord