I am having a really strange problem. I am trying to perform a for loop on a promise return value. When I run the code from a jasmine test it breaks. When I run it from a browser it breaks. The code is....
courseService.getCourseDates(8).then(function (data) {
console.log(data[0]); --this works
console.log(data[1]); --this works
for (s in data) {
console.log(data[s]);
}
}
Expected output:
'2014-06-14T00:00:00'
'2014-06-14T00:00:00'
'2014-06-14T00:00:00'
'2014-06-14T00:00:00'
Actual output from Karma/Jasmine:
ReferenceError: Strict mode forbids implicit creation of global property 's'
Actual Output from browser:
ReferenceError: s is not defined
Anyone know what is wrong? I have used for loops like this in the past and clearly the array is being populated okay....