я получаю ошибку на console-- screenshot app.js: 26 Uncaught TypeError: Не удается прочитать свойство «местоположение» неопределеннойДоступ вложенных объектов в JSON undefinded ошибки
я пытаюсь получить доступ к собственности data.places .geomtry.location.lat
var initialPlaces = {
"places":
[{
"geometry" : {
"location" :{
"lat" : "40.715813",
"lng" : "-74.009433"
}
},
"name" : "Acappella"
},{
"geometry" : {
"location" :{
"lat" : "40.715813",
"lng" : "-74.009433"
}
},
"name" : "Acappella"
}
]
}
var Place = function(data){
console.log(data);
this.geometry.location.lat = ko.observable(data.geometry.location.lat);
this.geometry.location.lng = ko.observable(data.geometry.location.lng);
this.name = ko.observable(data.name);
};