Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Removing Items From Arrays

Cody Norman
seal-mask
.a{fill-rule:evenodd;}techdegree
Cody Norman
Full Stack JavaScript Techdegree Student 3,421 Points

Removing Items From Arrays

In the video Dave goes to MDN and uses the console on MDN to instruct the video. I can pull up the console using both Ctrl+Shift+J and using the "More Tools -> Developer Tools" in Google Chromes options menu but when I try to follow along with the video I can't replicate his results, specifically after he sets up the "var nums = (1, 2, 3, 4, 5)" next he does nums.length and that's where thing go wrong, I get undefined rather then the length of nums. The nums.pop() doesn't work either returning undefined also. So either there is a different Chrome that I don't know about or MDN/Chrome has had an update that makes this video irreverent.

Can someone let me know what I'm doing wrong if its on my end.

var nums = [1, 2, 3, 4, 5];
nums.length //5

1 Answer

Mark Sebeck
MOD
Mark Sebeck
Treehouse Moderator 28,992 Points

It does work for me

var nums = [1,2,3,4,5];
undefined
nums.length
5
nums.length //5
5
nums.pop();
5

You might want to try upgrading Chrome to the latest version. BTW it doesn't matter what web page you are on. Anything you type in the console will run on any page for this exercise. I was on Google when I ran it.

Mark Sebeck
Mark Sebeck
Treehouse Moderator 28,992 Points

Not a rookie mistake. That's a typo and we all make them. Glad you got it to work.