Answer the question
In order to leave comments, you need to log in
How to render a variable in NodeJS?
I'm new to JS, making a status page for a minecraft server. I need to move the "gamever" variable outside of ping to use it later in the ejs file, how can I do that? (tried different ways, nothing worked)
const ping = require('minecraft-ping')
ping.ping_fe01fa({host:'play.kingnetwork.ru', port:25565}, function(err, response) {
const gamever = (response.gameVersion);
});
console.log(gamever);
Answer the question
In order to leave comments, you need to log in
const ping = require('minecraft-ping')
let gamever
ping.ping_fe01fa({host:'play.kingnetwork.ru', port:25565}, function(err, response) {
gamever = (response.gameVersion);
});
console.log(gamever);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question