I have an object like this
myObj = {
"strPattern": "Name: #name#<br>Surname: #sname#<br>Location: #loc#",
"name": "John",
"sname": "Doe",
"loc": "LA"
}
Now I need a function which will take my object and return it as a string with the help of its pattern.
Expected Result : "Name: John<br>Surname: Doe<br>Location: LA"
I couldn't do it with JavaScript's replace method and I dont know how to do it. Thank for your help.
By the way, number of subStrs can be dynamic. For example there are 3 subStrings in this example but it can be 5 or 10 for other objects. #age#, #gender#, etc...