I have a function that needs to get data from another function, but the second one is returning undefined and i don't know why.
function firstOne() {
    const companys = companysList();
    console.log(companys); // LOG UNDEFINED
};
.
function companysList(){
    db.query('SELECT id FROM companys WHERE id > 0', (error, result) =>{
        if (error) throw error;
        console.log(JSON.stringify(result)); // LOG THE ids!
        return result;
    });
};
 
    