-1
I am running the following code:
var dadosCarro = firebase.database().ref('carro');
dadosCarro.on('value', (snapshot) => {
var data = snapshot.val();
console.log(data)
});
As an answer on the console, I have:
{-NitWx_oNdW8uFnvmsVh: {…}}
-NitWx_oNdW8uFnvmsVh:
nome: "Onix"
marca: "Chevrolet"
ano: "2021"
How can I access the value of the name attribute, which in this case is "Onix" and assign in a variable?