It seems like I can't get the value of the data out of the function, when I use console.log inside the function it does work but I can't get the value out of the function.
function getFromDB() {
const ref; //the db ref
ref.on("value", data => {
return data.val();
}
);
}