samedi 24 juillet 2021

returning a variable of an if statement javascript

hi i want to use a variable that i create inside a else statement to use in another function but i cant figure out how

the code >

if (!e){
               await knex('empresa').insert({
                   razao_social,
                   cnpj
               }) 
            }else{
                const e_id = e.id
                console.log(e_id)
                return
            }

i want to get that e_id variable to use in another function but i dont seem to be able to do it

Aucun commentaire:

Enregistrer un commentaire