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

Array

Challenge Task 1 of 2

Create an array named data and store any 3 numbers in it. Bummer! I don't see 3 numbers in the array

what am i doing wrong?

script.js
var data = ['1','2','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

Abe Layee
Abe Layee
8,378 Points

By adding quotation around the number, it becomes a string. Get rid of the quotation from around the number like this. Check this is out for more information https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array

var data = [1,2,3]

I saw the issue and i fixed it can you help me with Challenge 2?

Ryan Field
Ryan Field
Courses Plus Student 21,242 Points

Challenge 2 is very similar to the first one. What specifically don't you understand?

For challenge 2 you just need to create one item as a string, one as a number, and one as a boolean value. You have already done the first two, so it should be fairly straightforward.