Your JavaScript code looks mostly fine, but it’s a bit repetitive. You’ve declared your variables and then assigned values to them separately. You can actually do both in one go. Here’s a more concise version:
— solution removed —
This way, you declare the variable and give it a value in a single line. Also, you don’t need to declare the variables again before assigning values; once is enough.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.