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

david Ramirez
PLUS
david Ramirez
Courses Plus Student 2,797 Points

i dont understand the question

array string with a value string , a number value, and a boolean

script.js
var data = [1 ,2 ,3]
var asssorted [ i , 4 , 0 < i];
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

You may be having trouble with the syntax for JavaScript datatypes Lets take a closer look at your answer:

var assorted = [ i, 4, 0 < i ] 

You're on the right track but lets break it down further to what you thought were valid values.

The question is asking for an array with a String, Number, Boolean values respectively

String: you put i for string was incorrect because i is interpreted as a variable by JavaScript but "i" with quotes makes it a string. Usually beginners have trouble with this. But you were on the right track.

Number: 4 was correct datatype. Nice!

Boolean: 0 < i there are two right answers to this true or false these are reserved keywords in JavaScript and have a special meaning, the answer you gave is a Boolean Expression

I thought this was a cool way how you answer with a Boolean Expression and I tested it and it actually passes in the interpreter but what actually gets stored is the Boolean value it equates to, either true or false not the Expression.

var data = [1, 2, 3,]
var assorted = ["one", 2, true]