I have this class, but whenever I instantiate, and access the value of fb_firstName
is 'undefined'. What am I doing wrong?
In the set method, setFb_firstName(firstName)
, the value is correct, but at the time of returning with getFb_firstName()
has no value.
function User(sender) {
var fb_firstName;
FB.api('/' + sender, 'get', {access_token: token.getPage_acess_token()}, function (response) {
setFb_firstName(response.first_name);
});
function setFb_firstName(firstName) {
fb_firstName = firstName;
}
;
this.getFb_firstName = function () {
return fb_firstName;
};
}