1
const database = firebase.database()


var phoneNumber = ''
function getPhone() {
    const phoneRef = database.ref('/phone')
    phoneRef.on('value', (snapshot)=> {
    this.phoneNumber = snapshot.val().nomer
    })
    return phoneNumber
}
console.log(phoneNumber)
console.log(getPhone())

how to insert the results of the get data into a variable?

And I want to make the get data function so that it can be called multiple times.

I'm using node.js

I have searched and tried many times and found no way to do it.

0 Answers0