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 trialAnthony Piscocama
4,328 PointsIs this considered bad coding practices or is it still readable?
var i;
var quiz = [
[parseInt(prompt("How many planets are in the solor system?")), 8],
[parseInt(prompt("Who won the last UCL")), 7],
[parseInt(prompt("Who won WW2")), 6],
]
var count = 0;
for(i = 0;i < quiz.length;i += 1){
if( quiz[i][0] === quiz[i][1] ){
count += 1;
}
}
print('you got '+ count +' questions right!')
function print(message) {
document.write(message);
}
1 Answer
Steven Parker
231,236 PointsThe code is probably OK, but to make it readable as intended here in the forum, you must use Markdown formatting.
See the the Markdown Cheatsheet pop-up below the "Add an Answer" area.
Or watch this video on code formatting.