var x ="apple";
socket.on('fruits',function(data){
var x = data; //var x is orange here
});
console.log(x); /// but var x is still apple here.....
socket.on('DatatoServer',function(
socket.in(x).emit('receivedData', data); ///I want this x to be orange
});
how do I make that var x to become global variable?
or is there a way I can use that orange var x in my second socket.on listener above?
Any help is appreciated