How do I save the result obtained in r.get ('quant') into a variable and return its value, because the first console.log shows the data I got, but the second does not, and the return quant always shows undefined on the console.
getQuantProduto(id, item){
var quant;
this.afs.collection(this.pedidos).doc(id).collection(this.itens).
doc(item).ref.get().then(function(r){
quant = r.get('quant');
console.log(quant);
})
console.log('quant');
return quant;
}