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 trialRonnelle Torres
5,958 PointsTHIS IS WHAT I DID IN PART 1.
function print (message, element) {
var HTML = document.getElementById(element);
HTML.innerHTML= message;
}
function list (name, track, achievements, points) {
return "<li>"+ name
+ "<ul>"
+ "<li>"+ track.join(", ") + "</li>"
+ "<li>" + achievements + "</li>"
+ "<li>" + points + "</li>"
+ "</ul></li>"
}
var insideHTML= "<ol>";
var students = [
{name:'ron', track:['html', 'css', 'javascript'], achievements:3000, points:3100 },
{name:'grace', track:['design', 'photoshop', 'html'], achievements:2000, points:2100 },
{name:'mae', track:['c#', 'python', 'php'], achievements:1000, points:1100 },
{name:'nel', track:['javascript', 'python', 'design'], achievements:4000, points:100 },
{name:'boom', track:['javascript', 'c#', 'android'], achievements:4000, points:100 }
];
for (i=0; students.length > i; i++) {
insideHTML+=list(students[i].name, students[i].track, students[i].achievements, students[i].points);
}
insideHTML+="</ol>"
print(insideHTML, "output");
4 Answers
Tommy Gebru
30,164 PointsI can only recommend quitting your job if it alleviates the burden of learning, also if your learning environment is positive and reinforces learning then it is a great choice to do so....
Tommy Gebru
30,164 PointsHey Ronnelle,
Please provide more information when posting to the forum
Ronnelle Torres
5,958 PointsOh I apologize. My question is, how can I print the property? In this code I have only printed the value. I was hoping to get this format printed. Please help, thanks! :D
Name: ron Track: javascipt , etc.
Aaron Martone
3,290 PointsI assume this code comes with some html like: <div id="output"></div>, right? Are you attempting to send the output to a printer? You can use window.print(); but I don't think it accepts arguments. It prints what was output to the document. If you want to just view the variable, you can use: console.log(innerHTML);
Tommy Gebru
30,164 PointsWere you able to pass the challenge?
Ronnelle Torres
5,958 PointsYes I did! :D The part 2 was a bit challenging.. Though thankfully I was able to do it without peaking on the solution video. hahah. Now I'm on the third challenge, the search thingy. I hope I can do it. It's hard to work at the same time study. I'm planning to quit my job so that I can study more.. Do you think it's a wise decision? Thanks for the advice! :)
Steven Parker
231,269 PointsSteven Parker
231,269 PointsAnd do you have a question or problem?