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

kelsey hayden
kelsey hayden
14,467 Points

Help with create an array code challenge

Im not sure what i am missing here? bug? error says i am still missing 3 numbers

var data = ["23", "45", "65",];
<!DOCTYPE html>
  <meta charset="utf-8">
  <title>JavaScript Loops</title>
<script src="script.js"></script>

1 Answer

Jasper Bloem
Jasper Bloem
22,424 Points

Hey Kelsey,

You used symbols to make your number a string, remove the quotes and you should be fine.

This will be your answer:

var data = [23, 45, 65];
kelsey hayden
kelsey hayden
14,467 Points

Thanks for the help! Must have missed that part in the video.

John Erickson
John Erickson
Full Stack JavaScript Techdegree Student 3,916 Points

It can be confusing, trust me I know as I'm new to javaScript. As Jasper has already explained, a number and a string are totally different. Anything placed inside quotes will be considered a string even if the value is a number i.e. "23". You can always use the typeof operator to help determine what value you're using. For example:

typeof( data[0] );

This will return "string" rather than number.

However as Jasper explained above:

var data = [23, 45, 65]; typeof( data[0] );

This will return "number" rather than string.

Hopefully this helps.