Nikola Flamel,
function change(){
var mainArray=[];
for(var i=0;i<arguments.length;i++){
mainArray[i]=arguments[i];
console.log(mainArray[i]);
}
return mainArray[0].replace(/\$(\d)/g,function(a,b){
return mainArray[b]
});
}
var numberOne = 1,
numberTwo = 2;
alert( change('<li id="$1">$2</li>', numberOne, numberTwo) );
|