So we have the classic example of interpolation like this:
const AGE = 25;
let result = `I'm ${AGE} years old!`;
What I am trying to achieve though is replace in a string I access through a variable, not directly. I never know how many items I must replace. Example:
const Item_Required = "The {item} is required and needs to be between {min} and {max} {unit}!"
const ContractTitle = "Contract Title"
const Unit_Characters = "characters";
let result = Item_Required
.replace("{item}", ContractTitle)
.replace("{min}", 3)
.replace("{max}", 100)
.replace("{unit}", Unit_Characters );
Is there a more direct and nice way to do this? Or is this the way to go?