function jsonFormat(template, json) {
return template.replace(//$/{(.+?)/}/g, function ($, $1) {
return json[$1];
});
}
function($,$1)两个参数,而函数体中只能用$1
return template.replace(//$/{(.+?)/}/g, function ($, $1) {
return json[$1];
});
}
function($,$1)两个参数,而函数体中只能用$1
alert(arguments.join(','));
}
JS里函数参数没那么严格
a(123);
a(123,'ABC');