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 trialJelena Feliciano
Full Stack JavaScript Techdegree Student 12,729 PointsI am getting a syntax error stating Missing initializer in const declaration but I did it the way the teacher shows.
const middle = ['lettuce', 'cheese', 'patty']; const burger = ['top bun', ...middle, 'bottom bun'];
const brass = ['trumpet', 'trombone', 'French horn', 'baritone', 'tuba']; const woodwind = ['flute', 'oboe', 'clarinet', 'saxophone', 'basoon']; const instruments = [ ...brass, ...woodwind ],
console.log(instruments);
2 Answers
furkan2
Courses Plus Student 3,044 Pointsconst middle = ['lettuce', 'cheese', 'patty'];
const burger = ['top bun', ...middle, 'bottom bun'];
const brass = ['trumpet', 'trombone', 'French horn', 'baritone', 'tuba'];
const woodwind = ['flute', 'oboe', 'clarinet', 'saxophone', 'basoon'];
const instruments = [ ...brass, ...woodwind ], // ERROR HERE COMMA AT END
console.log(instruments);
You have placed a comma instead of a semi-colon at end of the const instruments.
R S
2,255 PointsChange the comma to a semi colon when creating the instruments array const instruments = [ ...brass, ...woodwind ],