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 Arrays Store Multiple Values in an Array Add Elements to an Array

Gal Parselany
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Gal Parselany
Full Stack JavaScript Techdegree Graduate 26,281 Points

something cool I write according to this lesson :

const main = document.querySelector('main');
const instruments = ['piano', 'guitar', 'darbooka'];
instruments.push('drums', 'violin', 'triangle'); 
instruments.unshift('cowbell', 'tuba');

const testInstrument = prompt('Which instrument you would like to learn?');
instruments.unshift(`${testInstrument}`);

main.innerHTML =
 `
<h2>You would like to learn ${instruments[0]}</h2> <br>
<p>while you already know ${instruments[1]}, ${instruments[2]}, ${instruments[3]}, ${instruments[4]}, ${instruments[5]}, ${instruments[6]}, ${instruments[7]}, ${instruments[8]}</p>
`;