I know it's sunday evening and most of you will have better thinks to do but a buddy of mine keeps asking me for an application to analyze "the party people" who attend his events...
As part of the application he asked me for some kind of "girls-percentage" calculator for marketing ;)
As Facebook provides access to user data through the Graph API I used this code to retrieve the gender of 1000 users to calculate the percentage.
function getGender(userID) {
var userGender = "";
FB.api(
'/' + userID,
function (response) {
if (response && !response.error) {
userGender = response.gender;
console.log(userGender);
}
}
);
return userGender;
}
But the JS function does not return any value, except an empty string... So how do I get JS to assign the value correctly?