I have the following function :
/**
* ParkingTime Duration, which is shown by the size of each circle/bubble.
*
* @param garage
* @param res
* @returns {*}
*/
function getParkingDuration(garage, res) {
var parking = res.parking;
var parking_duration = Array();
for (var j = 0; j < parking.length; j++) {
if (typeof parking[j][garage].parkingtime != 'undefined') {
parking_duration.push(parking[j][garage].parkingtime);
} else {
parking_duration.push(0.1);
}
}
return parking_duration;
}
if there is an undefined variable, i want to push a value to some array.
But when i check my console i still see some errors of parkingtime undefined.
Why the code is not reaching my else statement?
parking[j][garage]is undefined