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.

JavaScript JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Create an Array

analyn jane calado
analyn jane calado
3,523 Points

clarify me please... what going on?

i can't get the correct answer.

var data = [1,2,3];
var assorted = [1];
var assorted = [2];
var assorted = [3];
<!DOCTYPE html>
  <meta charset="utf-8">
  <title>JavaScript Loops</title>
<script src="script.js"></script>

2 Answers

So the second array should have assortment of data types, a number, a stritrng and a boolean value like true or false.

var assorted = [ "Hi my name is", true, 13];

that should do it for ya good luck

analyn jane calado, try this or Trace Harris

Trace's example should work fine for you.

The challenge wants you to create a second array called assorted and add 3 values to the array, 1 as a string, 1 and a number and 1 and a Boolean.

Where 'I am a string' is a string because it is wrapped in quotes, 1 is a number literal if it were wrapped in quotes it would be a string representation of a number. And the last value of false or true in Trace's example is a Boolean.

var data = [1, 2, 3];

var assorted = ['I am a string', 1, false];