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 trialchannonhall
12,247 PointsI've been workin' on this for days now can someone help me? Can't seem to find the answer
I don't know the answers to this quiz and i've been working for days so can someone help me out?
Maybe I'm Just a bit dumb xD
Thanks! Channon
1 Answer
Marco Amadio
4,882 PointsHi Channon.
In this quiz you have to use some array methods:
The unshift method adds an element at the beginning of an array. e.g.
var array = [1, 2, 3];
array.unshift(0);
/* The results will be */
[0, 1, 2, 3]
The push method adds an element at the end of an array. e.g.
var array = [1, 2, 3];
array.push(4);
/* The results will be */
[1, 2, 3, 4]
The shift method removes the first element of an array. e.g.
var array = [0, 1, 2, 3];
array.shift();
/* The result will be */
[1, 2, 3]
The pop method removes the last element of an array. e.g.
var array = [1, 2, 3, 4];
array.pop();
/* The result will be */
[1, 2, 3]
The length porperty will return the number of elements in an array.
var array = [0, 1, 2, 3];
var length = array.length;
/* length variable's value will be 4 */
Hope it helps.
john larson
16,594 Pointsjohn larson
16,594 PointsMarco, I just have to say how beautifully organized your answer is. I love that.
Marco Amadio
4,882 PointsMarco Amadio
4,882 PointsThank you! I'm glad to be of help :)
channonhall
12,247 Pointschannonhall
12,247 PointsOh thanks! So I did mixed them up xD
Thanks Marco!
Marco Amadio
4,882 PointsMarco Amadio
4,882 PointsChannon, you're welcome ;)