This is the first time I've used JS objects and I'm confused as to why this property is always undefined:
function Rotator() {
    this.interval = 300;
    this.image = 0;
    this.images = undefined;
}
Rotator.prototype.Fetch = function(links) {
    console.log("Fetch called");
    this.images = links;
}
Rotator.prototype.Current = function() {
    if (this.images == undefined) {
        console.log("Error, images is undefined");
    }
    return this.images[this.image];
}
r = new Rotator;
$.getJSON("./data.php", function (data) {
    r.Fetch(data.images);
});
console.log(r.Current());
The error I get is:
Uncaught TypeError: Cannot read property '0' of undefined
The JSON returned is working fine, and fetch is marked as called in the console (when logged the data is fine as well). Why is Rotator.images always undefined?
Edit: Some console.log results:
- Logging data.imagesin$.getJSONresults in correct data.
- Logging linksinFetchresults in correct data.
- Logging this.imagesinFetchresults in correct data.
- Logging this.imagesinCurrentresults in null.