0

I want call local scope in outside my function how i can do it without making the variable on a globally.. snapAuthor

(function(){
var snapAuthor=AuthorsInfo.filter(function(a){return a.name===&#39;<data:title/>&#39;})[0];
});

console.log(snapAuthor); // snapAuthor is not defined
MSDesCUC
  • 17
  • 5
  • Put `var snapAuthor;` at the top. And remove `var` from inside, so it's just `snapAuthor =` – zoran404 Apr 01 '20 at 19:41
  • This cannot be done because I have more than one job in the same shape but with different values ​​and if I make the variable globally it comes with the characteristics of only one function and ignores the rest – MSDesCUC Apr 01 '20 at 19:42
  • You can't use it globally if it's not global. Looks like you didn't formulate your question correctly. Please post the rest of your code so someone can help you. – zoran404 Apr 01 '20 at 19:45

0 Answers0