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 trialkelsey hayden
14,467 PointsHelp 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>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
1 Answer
Jasper Bloem
22,424 PointsHey 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
14,467 Pointskelsey hayden
14,467 PointsThanks for the help! Must have missed that part in the video.
John Erickson
Full Stack JavaScript Techdegree Student 3,916 PointsJohn Erickson
Full Stack JavaScript Techdegree Student 3,916 PointsIt 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.