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 trialJason Vines
5,207 PointsJS Loops, Arrays & Objects not recognizing legitimate code...again.
It's probably another peculiarity with the Treehouse site but I have a Challenge Task that doesn't like my answer but that answer will work in the console of a web browser. Somebody tell me what the site is looking for that I can't see.
var coordinates = [
[24, 36],
[48, 52],
[66, 09],
[33, 18]
];
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Objects</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
1 Answer
Joe Beltramo
Courses Plus Student 22,191 PointsThis shouldn't work in any system? Anyway, structurally you are correct. The issue here is the numbers you provided. The JavaScript compiler has no idea what 09
is, remove the zero in front of the 9 and give that a shot.
Jason Vines
5,207 PointsJason Vines
5,207 PointsThanks for the help on this. It's always the little things isn't it but it was recognized in the console.log I printed in Chrome and it dropped the 0 and still listed the array.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi Jason,
When you put a leading zero on a number like that then it gets interpreted as an octal number. Octal is base 8 so it only uses the digits 0-7.
09 would not be a valid octal number. The chrome console does not issue an error for this but in the firefox console you get the following error:
I'm guessing that the challenge checker is catching this error as well which is why you couldn't pass.
If you had used
07
instead then you would have passed the challenge because that would be a valid octal number.