I have the code:
var here;
function setNews(data2){
here = data2;
console.log(here);//1st console log
}
console.log(here);//2nd console log
in the 1st console log the the data inside here are printed but in the 2nd console log it prints undefined how can i access the data inside the setNews function so that I can use it outside setNews.
Thank you.
var here; function setNews(data2){ here = data2; console.log(here);//1st console log } setNews("ff"); console.log(here);//2nd console log