I would strongly encourage you to use the functional form of String.replace() to solve your problem, rather than trying to parametrize the regexp in a for-loop that iterates over {0},{1},etc.
In other words, rather than look for '{0}' or '{1}', just look for '{([0-9]+)}' (i.e. {}'s surrounding an arbitrary number, and pass a function to the replace() function to intelligently replace these expressions based on the number between the {}'s. This lets you use a RegExp literal which you can write as /{([0-9]+)}/ rather than mess around with escape characters in strings.
Something like this:
s='the song says {0} little {1} little {2} little-endians';
args=['zero','one','two'];
new_string = s.replace(/{([0-9]+)}/g, function(wholematch,firstmatch)
{return args[(+firstmatch)]; }
);
which yields
the song says zero little one little two little-endians
See this similar question.
edit: if you want to leave alone items that are greater than the length of your args
list, make sure to sanity-check the parameter number:
s='the song says {0} little {1} little {2} little-endians,\n'+
' {3} little {4} little {5} little-endians';
args=['zero','one','two'];
new_string = s.replace(/{([0-9]+)}/g, function(wholematch,firstmatch)
{var i = +firstmatch; return i < args.length ? args[i] : wholematch;}
);
which yields
the song says zero little one little two little-endians,
{3} little {4} little {5} little-endians