i cant access a global variable in type script in an other method.
As i have initialized this "initiatorOffer" global variable in this methode
peerx.on('signal', function(data)
{
   console.log("1");
   console.log(JSON.stringify(data));
   this.targetpeer = data;
   **this.initiatorOffer = JSON.stringify(data);  // i have initialized there**
   console.log(this.initiatorOffer);
}
but when i get this value in other method on same file which is:
this._chatservice.clientconnected().subscribe(data => {
   **console.log(this.initiatorOffer);** // getting value
})
i get the undefined value. why is that? as this variable is global.
this.chatservice.clientconnected() method called when i get a response from 
server.
 
     
     
     
    