How can I have the same property of a JavaScript object hold different values?

I’m working with Firebase with vanilla JavaScript and I’ve realized I’m dealing with the following issue.

let title_confirm = document.querySelector("#story-title").value;
let chapter_title = document.querySelector("#chapter-title").value;
let chapter_part = document.querySelector("#chapter-part").value;

firebase.database().ref(doc.data().first_name + “'s Stories/” + title_confirm + “/Chapters”).set({
chapter_title: chapter_title,
chapter_part: "Part for → " + chapter_title + " ==> " + chapter_part
});

What I’m trying to do is, I want the same properties (chapter_title, chapter_part) to stay the same, but I want the keys to hold different values.

However, whenever sending the data to Firebase, I’ve realized that the data gets replaced with the most recent data I send instead of adding another bit of data to the database.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.