A Real-World Example
Objects
const currentProfileUser = profileDisplay.uid; const loggedInUser = firebase.auth().currentUser.uid
var obj = { loggedInUser:1 };
Luckily, we can create an object and then use bracket notation to set a parameter. It would look something like this:
var obj = {}; obj[loggedInUser] = 1;
The Awesomeness of Firebase
var myRef = firebase.database() .ref('/users/' + self.auth.currentUser.uid + '/following/'); myRef.set(obj, function (error) { console.log('ok ' + error); });