String.prototype.format=function()
{
  if(arguments.length==0) return this;
  for(var s=this, i=0; i<arguments.length; i++)
    s=s.replace(new RegExp(""\\{""+i+""\\}"",""g""), arguments[i]);
  return s;
};
console.log(""js实现用自符串替换占位符{0} {1} {2}"".format(""I"", ""LOVE"", ""YOU""))