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 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.

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

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];