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 trialJeff Borg
4,302 PointsMy code is different then what was presented in the soloution video.
I ran through this challenge and got my output to resemble that of what was required, however I coded this differently. Are there any advantages or disadvantages to how I wrote my code vs how it is portraied in the video?
var message = '';
function print(message) {
var div = document.getElementById('output')
div.innerHTML = message;
}
for (var x in students) {
message += '<b><p>Student: ' + students[x].name + '</p></b><p>Track: ' + students[x].track + '</p><p>Points: ' + students[x].points + '</p><p>Achievements: ' + students[x].achievements + '</p>';
};
print(message);
2 Answers
Steven Parker
231,275 PointsIn programming, it's the result that counts.
The more complex a task is, the more different ways a program can be written to handle it. Any way that creates the correct result is a "right" way, particularly in such a small program.
With experience you will learn techniques to make your larger programs more efficient, compact, and easily understood. But achieving the goal will still be the primary objective.
Jeff Borg
4,302 PointsThanks Steven! I just wanted to make sure it was still a passable chunk of code :)
Much appreciated!