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,452 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,658 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,452 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,658 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,452 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.