jQuery toggleClass example

Toggle class name on click in jQuery

by dshilkret

JavaScript

function format(source, params) {
alert(source);
alert(params);
for (var i = 0; i < params; i = i + 1) {        
source = source.replace(new RegExp("\\{" + params[i] + "\\}", "g"), params);

}
    //$.each(params,function (i, n) {
//        source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n);
 //   })
    
    return source;
}
alert(format("{0} is a {1}", ["Michael", "Guy"]));