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!

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
.a{fill-rule:evenodd;}techdegree seal-36
Gal Parselany
Front End Web Development Techdegree Graduate 19,383 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?');

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>