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 trial

JavaScript

Arrays:Push & Pop

Trying to follow along with Push & Pop, This script:

//Push
var my_array = [2,3,4];
console.log(my_array.toString());

my_array.push(5);
console.log(my_array.toString());

//Pop
var value = my_array.pop;
console.log(my_array.toString());

is supposed to cut the '5' off of the end, but mine won't work.....any idea's?

4 Answers

Stone Preston
Stone Preston
42,016 Points

you are missing the () on your pop method call

you have

var value = my_array.pop;

try

var value = my_array.pop();

This is my code for that section: ``` var my_array = [2, 3, 4]; console.log(my_array.toString());

my_array.push(5); console.log(my_array.toString());

var value = my_array.pop(); console.log(my_array.toString()); ```

Hope that helps.

Hi Douglas,

You have: var value = my_array.pop;

You're missing the parentheses on the end. You need them in order to call the method.

var value = my_array.pop();

Ah.....i see it!

I will try and keep a better eye,thanks.