Friday 21 April 2017

How to access a private variable in JavaScript [duplicate]

I need to access the variable things that is inside the function.

var movie={};
var name = 'The Hangover';

imdb.getReq({ name: name }, function(err, things) {

    movie = things;

    }

  });
console.log(movie); //returns an empty object {}



via melhirech

No comments:

Post a Comment