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 trialThomas Ma
15,199 PointsNext, add two names to the beginning of the array using the unshift() array method. The final array should have eight na
I dont know what i did wrong
var guestList = ['Sandra', 'Omar', 'Magnus', 'Becky'];
guestList.push('Mars', 'Mary');
guestList.unshift('Alex', 'Jason', 'David');
ERIN KOONTZ
6,041 Pointsvar guestList = ['Sandra', 'Omar', 'Magnus', 'Becky']; guestList.push('Mars', 'Mary'); guestList.unshift('Alex', 'Jason' );
1 Answer
Tom Nguyen
33,501 Pointsmy solution:
const guestList = ['Eleven', 'Dustin', 'Lucas', 'Will'];
guestList.push('new_guest_1','new_guest_2');
guestList.unshift('add_to_beginning_1', 'add_to_beginning_2');
Julian Addison
13,302 PointsJulian Addison
13,302 PointsYou're using the unshift method properly. What you've done wrong is that you've added three new names to the array. Just remove 'David' from the method call. The result of the second task is that the array needs 8 names, and your array has 9 once the code runs.