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 trialAYMERIC FIGEROU
3,748 PointsLast Quiz Questions:
Hello,
I would like to know what's the following answer for:
1st Questions Complete the code below. Use a method you were taught in this course to remove the last item from the students array. (Hint: don't forget the parentheses)
var lastStudent = students. ANSWER;
2nd Questions: Complete the code below to display every property and value of an object named location: ANSWER ( property.ANSWER location ) { document.write('<p>' + property + ':' + location[property] + '</p>');
If you add an explenatory line, it will be great. I have reviewed the video, and didn't not quite understand what is it asked.
Thanks you for reading and answering
3 Answers
Jacek Szemplinski
6,423 Points1st)
var lastStudent = students.pop();
pop() removes the last item from specified array and returns it, so now the last student is placed within the variable lastStudent
2nd)
for ( property in location ) {
document.write('' + property + ':' + location[property] + '');
}
Just a for...in loop, you can find in-depth explanation on MDN Website
ub46473788
8,782 PointsFor your first question, you'll want to use .pop() (see: this for more ).
For the second question, you'll want to use the 'for...in...' statement (see: this for more).
Emmanuel Plouvier
11,919 PointsEmmanuel Plouvier
11,919 PointsHi,
For the first answer you must use the
pop()
method MDN pop().For the second answer it a
for ... in
loop MDN For in Loop