Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Quiz has been done, I'm looking for feedback!

Anything is welcomed as long as it's constructive! https://w.trhou.se/6fio6wxmwi

Thank you!

1 Answer

Nice work, however i have some suggestions. I don’t understand why u created the first 3 variables u can just use alert or display a p tag to inform the user what’s going on. you should use an multi demendional array or objects to store the question and the answer. for example if u decide to use arrays , the first index should be the question and the second one is the answer. after that u can loop through the multi-dimensional array and check if the user input is equal the the answer which stored in index 2

another suggestion is instead of using || to check different variations of user input u can just use the method includes() which check if for example the word 2003 is in the user input.

you can also use the new es6 template literal to concatenate.

varlevi
varlevi
8,113 Points

Just note that while es6 template literals have pretty good support, they are not supported in IE and some mobile browsers.