我刚结束这样做:
String.prototype.toCamelCase = function(str) { return str .replace(/s(.)/g, function($1) { return $1.toUpperCase(); }) .replace(/s/g, '') .replace(/^(.)/, function($1) { return $1.toLowerCase(); });}我试图避免将多个replace语句链接在一起。在我的函数中有$ 1,$ 2,$
3的东西。但是,这种类型的分组很难理解,您对跨浏览器问题的提及也是我从未想过的。



