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

Jquery Checking Values Module

I am having a bit of a time with the "Checking Values" challenge because of trying to understand the video. When andrew starts talking about the "arrays" and the "pop" and the "push " I do not understand. Did i skip a video they explains arrays, pop and push earlier in the interactive web?

Although I cannot help you by answering your questions, I just wanted to say that I sympathize with you! The "build an interactive website" has a very steep learning curve in comparison with the modules that followed before.

Preferably I would like team treehouse to take it a little bit more slow if they ever revise the module.

Hey thanks! I have been able to understand the rest of the courses but this one has had me stumped. I agree thought that this checking values in the interactive web module has been the most difficult so far but i am sure i will get it soon.

1 Answer

If you are ever confused about a topic, you can always refer to the documentation of the subject (in this case JavaScript/jQuery). For example here is how the .pop() method works.

To actually answer your question: an Array is a collection of values: ["apple", "orange", "banana"] <- that is an array containing 3 fruits as an example. If I use the '.push()' method on this array, I can add one more fruit to my array of fruits:

var fruits =  ["apple", "orange", "banana"];
fruits.push("grapes");
// fruits now =  ["apple", "orange", "banana", "grapes"]
fruits.push("coconut");
// fruits now =  ["apple", "orange", "banana", "grapes", "coconut"]

If I use the .pop() method on this array, it will remove the last item from the fruits array:

var fruits = ["apple", "orange", "banana", "grapes"];
 // fruits now =  ["apple", "orange", "banana", "grapes"]
fruits.pop();
// fruits now = ["apple", "orange", "banana"]
fruits.pop();
// fruits now = ["apple", "orange"]
fruits.pop();
// fruits now = ["apple"]

Does that clear things up a bit?

Riley Hilliard thanks so much man. In all actuality it really does clear some things up. Thanks!