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

Methods Part 3 Question 2/3 not passing

For some reason this question isn't passing.

On about line 19, set the variable 'shortSaying' to be a slice of the 'saying' array to include the strings of "quick", "brown", and "fox".

var first =  ["The", "quick", "brown", "fox", "jumps"]
var second =  ["over", "the", "lazy"];
var saying = first.concat(second, "dog"); 
var shortSaying = saying.slice("quick", "fox");
var sayingString = saying;

It comes up as "Bummer! The 'shortSaying' should be 'quick,brown,fox' not '' "

http://teamtreehouse.com/library/websites/javascript-foundations/arrays/methods-part-3-2

What am I doing wrong?

2 Answers

Array indexes are numbers not the actual contents of the array. So to figure out what indexes you want figure out the position of the first element you want and one past the last element you want.

var shortSaying = saying.slice(x,y); "x" is the inferior position number limit,"y" is the superior position number limit.