JavaScript JavaScript Loops, Arrays and Objects Tracking Data Using Objects Accessing All of the Properties in an Object

Karly Lamm
Karly Lamm
Full Stack JavaScript Techdegree Student 6,491 Points

I didnt think the key name mattered but I am getting an error that strict mode does not allow this name

I have tried doing it just like the practice problem, but it is not working

var shanghai = {
  population: 14.35e6,
  longitude: '31.2000 N',
  latitude: '121.5000 E',
  country: 'CHN'
for(property in shanghai){
<!DOCTYPE html>
  <meta charset="utf-8">
  <title>JavaScript Objects</title>
<script src="script.js"></script>

1 Answer

Steven Parker
Steven Parker
194,932 Points

It's not the name but that you forgot to declare it:

for (let property in shanghai) {    // you could also use "var"

Strict mode does not allow implicit global declarations.