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 trialAndrew Alvarez
11,964 PointsHelp
Challenge Task 1 of 2
The newYork variable contains an object, but the population is wrong. Add a line of code that sets the population property to 8.406e6. Don't change the original object.
Bummer! You need to set the population property to the numeric value 8.406e6.
what am i doing wrong?
var newYork = {
population: 100,
latitude: '40.7127 N',
longitude: '74.0059 W'
};
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Objects</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
2 Answers
Erik McClintock
45,783 PointsAndrew,
As of right now, based on what you posted, it looks like you haven't done anything towards what the task has asked of you.
You need to write a line of code that will alter the value stored in the newYork object's population value to the numeric value of 8.406e6 (keeping in mind, you are not allowed to directly edit the value in the object itself).
What have you tried?
Erik
Joyce Mapuranga
1,513 PointsTommy is right but just add the new codes on line 6 and 7 not inside the curly braces
Tommy Gebru
30,164 PointsTommy Gebru
30,164 PointsChallenge Task 1 of 2
The newYork variable contains an object, but the population is wrong. Add a line of code that sets the population property to 8.406e6. Don't change the original object.
newYork.population= 8.406e6 //passes
Challenge Task 2 of 2
Add a new property -- country -- to newYork. Don't change the original object, just add this new property using a = sign to assign the country property to USA.
newYork.country="USA" // passes