Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Michael Humenick1,138 Points
I do not understand arrays at all
Thanks in advance!
MFrank Johnson5,040 Points
// START CONSOLE
// Create an array named 'arrayColor' which contains colors!
let arrayColor = ['blue', 'green', 'yellow'];
// Make the console show the array and its contents.
// The above command will show the following output indicating an array with 3 elements.
// > (3) ["blue", "green", "yellow"]
// If you click on the little arrow in front of the #3, you should see something similar to the following.
// (3) ["blue", "green", "yellow"]
// 0: "blue"
// 1: "green"
// 2: "yellow"
// length: 3
// proto: Array(0)
// Show the color of the sky in the console.
console.log('The sky is ' + arrayColor);
// The above command prints 'The sky is blue' to the console.
// Show the color of grass in the console.
console.log('Grass is ' + arrayColor);
// The above command prints 'Grass is green' to the console.
//Show the color of the sun in the console.
console.log('The sun is ' + arrayColor);
// The above command prints 'The sun is yellow' to the console.
// END CONSOLE
Hope that helps.
Want to test your understanding? Write a command to the console using your new array that says 'blue and yellow make green'. Add your answer here and we'll see if you got it.