I have an app linked to firebase. When a user logs in, I assign his object firebase.auth().currentUser to a variable. Then, I add a property (username) to that variable . The thing is that when I console.log(currentUser) I get the object with the added property. But, when I try to JSON.stringify it then JSON.parse it again (i do this to store it on localStorage) I can't find my property username that I added. What's happening here ?
var currentUser = firebase.auth().currentUser
currentUser.username = 'Foo';
console.log(currentUser) // => i get my prop username here
console.log(JSON.parse(JSON.stringify(currentUser))) // => i cant find my added prop here