## 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.

# How can my solution be improved?

JavaScript is the first programming language I'm learning. I wrote this program twice - the first time I felt like my code wasn't very efficient at all, so I took a good long look at it and tried to apply concepts learned elsewhere (via Intro to Programming course, or a trip to the MDN).

This is my final solution, and I'd like to know if it can be improved or otherwise incorporate different, more efficient techniques (note that I used both the && and || operators in two different if statements - I was just trying to test them out).

Also, I was wondering of the best way to handle if the user input is equal to a string, such as "two" - right now I'm restricted to the user input being a number string. Thanks!

```var correctAnswers = 0;
var questions = [{question: "What is 1+1?", answer: 2},
{question: "What is 2+2?", answer: 4},
{question: "What is 4+4?", answer: 8},
{question: "What is 8+8?", answer: 16},
{question: "What is 16+16?", answer: 32}];

for (var i = 0; i < questions.length; i++) {
var input = prompt(questions[i].question);
}
};

document.write("<h1>You got " + correctAnswers + " questions right! Here's a gold crown.</h1>")
document.write("<h1>You got " + correctAnswers + " questions right! Here's a silver crown.</h1>")
document.write("<h1>You got " + correctAnswers + " questions right! Here's a bronze crown.</h1>")
} else if (correctAnswers === 0) {
document.write("<h1>You got " + correctAnswers + " questions right! Huh. That's no questions right at all! Take up some arithmetic.</h1>")
}
```

Hello!!

It's nice, it worked ok

And...

I was able to score a 5 !!

:D

well done