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 Data Using Objects Add Properties to an Object

Creating an iterable object

I believe this is correct, although the code-challenge-console tells me it can't find the three properties: population, latitude and longtitude.

script.js
var paris = {
  population : 2.211e6,
  latitude : '48.8567 N',
  longtitude : '2.3508 E'
};
index.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JavaScript Objects</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

2 Answers

andren
andren
28,503 Points

You have a typo in your in the word longitude, you misspelled it as longtitude (you have an extra t in the middle) if you fix that typo then your code will be accepted.

jeez... You're right! Thanks Andren

Steven Ang
Steven Ang
40,665 Points

Put double quotes around them.

No works man. I've tried double quotes single quotes, around the properties and the values..

andren
andren
28,503 Points

You don't need to use double quotes to create a string in JavaScript. Single quotes like Kristian is using is valid, and the population value is a number so using quotes of any kind would technically be wrong.

Steven Ang
Steven Ang
40,665 Points

My fault of not spotting the spelling mistake, and also I'm entirely awarded of the fact that single and double quotes are personal preference in JS. Why I said, that is because maybe for some odd reason, the challenge doesn't accept single quotes so maybe try to put double quotes instead to see whether it function properly.

I tried the challenge, copy paste everything I needed to pass the problem, but I won't let me. So, I tried to replace the single quotes with double quotes, and somehow it worked. That pretty much conclude why I gave that answer.

andren
andren
28,503 Points

All right I got you, it is true that challenges can at time be pretty picky so it wouldn't be the biggest shock if the type of quote used was the issue. Though in this case the spelling issue was the only problem, once that was fixed the code was accepted even with single quotes being used.