I got a simple socket.io function, and I can print datas to ejs view. But I would like to use the data also for a variable outside the function. But have no idea...
var data_ras_height = "";
socket.on('ras_height', function (data_ras_height) {
document.getElementById("ras_height_text").textContent = data_ras_height;
console.log(data_ras_height); // This prints values
});
console.log(data_ras_height); // This prints nothing