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 JavaScript Foundations Arrays Splice

stuck on javascript splice

i think this is right i mean i understand that to replace it i use the index and add quick with slow and brown but when i check it i get Bummer! There was an error with your code: SyntaxError: Parse error any help with it would be great. i all ready done it lol.

var saying = ["The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"];
            saying.splice(2,2 'slow', 'red');//Stuck on

1 Answer

Aaron Graham
Aaron Graham
18,033 Points

I think you want this:

saying.splice(1, 2, 'slow', 'red');

Basically, you want to start replacing items at index 1, and you want to replace two items. Aside from that, I think the parse error is coming from a missing comma between the 2 and 'slow'.