Can anyone please suggest what I am doing wrong here. I want to get same output with both console.log() statements.
createModel(){
getvalue("asdfgh");
}
var myservice;
function getvalue(value){
myservice = value; console.log("inside: "+JSON.stringify(myservice));
//prints: asdfg
}
createModel();
console.log("outside: "+JSON.stringify(myservice));//prints: undefined
return (myservice);