i've a problem in js. I've a function for example:
function robePersos() {
    var persos = {"player" : "data"};    
    return persos;
}and then i've another function which call robePersos() like this:
function test() {
    var d = robePersos();
    for(var k in d) {
        console.log(k)
    }
}But nothing happens. Why ?
function robePersos() {
  var persos = {
    "player": "data"
  };
  return persos;
}
function test() {
  var d = robePersos();
  for (var k in d) {
    console.log(k)
  }
}
test();EDIT The first snippet works. So, here is my real function:
function robePersos() {
  var persos = {};
  $.get({
         url : 'url',
         success : function(data) {
             var text = $(data).find("div[menu='perso']  a"); //.clone().children().remove().end().text();                            
             $(text).each(function(){
                 perso_name = $(this).text();
                 perso_link = $(this).attr('href');
                                   
                persos[perso_name] = perso_link;
              });
                            
                            
         }
  });
  
  for(var k in persos) {
    console.log(persos[k]);
  }
              
}
robePersos();If I replace the loop by only console.log(persos) it works but the loop return nothing. Why ?
 
     
    