var test = function() {
'use strict';
var mapNames = {
'name': 'City Name:',
'coord.lat': 'Latitute:'
};
for (var key in mapNames) {
var names;
if (mapNames[key]) {
name = mapNames[key];
} else {
name = key;
}
}
console.log(name);
}
test();
In the code above I made a mistake by declaring variable names
and using name
instead. I thought 'strict' mode would catch it but it didn't. Shouldn't this throw an error in this case?