I have a string that comes from user: Below is an exact example
var message = "You purchased $name on $date"
Am within a Firebase Listener where variable querySnapshot is carrying data, how can looop through message and replace every occurence of $ to take the variable immediately after $ eg date and make the message be like below
message = "You purchased + querySnapshot.get("name") + on querySnapShot.get("date")
Thoughts: I imagine checking through the string message and finding all occurences of $ and getting the value after them. Then replacing $value with querySnapshot(value)...if you know how how i can implement this, kindly help out.