I wrote an object, it has 4 keys and values. How can I get the keys and values separately using a for loop?
I tried the below code, but no luck.
var timeObject = {
getNewYorkLocalTime: 'getTime.php?lat=40.7143528&lan=-74.0059731',
getLondonLocalTime: 'getTime.php?lat=51.5001524&lan=-0.1262362',
getChennaiLocalTime: 'getTime.php?lat=13.060422&lan=80.249583',
getBangaloreLocalTime: 'getTime.php?lat=12.9715987&lan=77.5945627'
}
for (var x in timeObject) {
alert(timeObject[x].value);
}
Can anyone help me? I'm using jQuery in this page, so a jQuery solution is ok too.