I have an object with following markup :
Object {workout: Object}
workout: Object
1/12/2015: Array[3]
0: "workoutTitle0"
1: "workoutTitle1"
2: "workoutTitle2"
2/12/2015: Array[3]
3/12/2015: Array[3]
4/12/2015: Array[3]
5/12/2015: Array[3]
6/12/2015: Array[3]
7/12/2015: Array[3]
I want to check if for example the field 10/12/2015 exists - if exists I want to load array that this field is holding, if not create new empty array for that field.
I tried this code but I get false everytime, even when field do not exist:
function isEmpty(obj) {
var prop = '10/12/2015'
for( prop in obj) {
if(obj.hasOwnProperty(prop))
return false;
}
return true;
}
Here if JSFiddle :