I have these declared:
var obj = {aaa: "came", bbb: "saw", ccc: "conquered", zzz: "discarded" };
var str = "I {aaa}, I {bbb}, I {ccc}. Then I {aaa} again."
What I want to do is str.replace() each curly braced string with the appropriately named property from obj. So in the end, I should have:
I came, I saw, I conquered. Then I came again.
Thank you.
EDIT:
The linked duplicate indeed proved very appropriate for my case. In addition, answers on that question actually provide dynamic solutions for the case where I did not know the properties of obj ahead of time.