I have object like this var o = $scope['reservation']['bookings'][bookingKey]['meals']
When I do
if (o.hasOwnProperty('checkedProperty') {
// code
}
I have error Uncaught TypeError: Cannot read property 'hasOwnProperty' of undefined
.
I try too:
if (o['checkedProperty']) {
// code to do if my object 'o' has 'checkedProperty'
}
but I have error: Uncaught TypeError: Cannot read property '26' of undefined
.
How can I do to check this property?