转换为驼峰命名法
最后更新于
最后更新于
var s1 = "get-element-by-id"; 给定这样一个连字符串,写一个function转换为驼峰命名法形式的字符串 getElementById
匹配 ' - '
对后面的首字母大写
replace
的语法
其中function
的回调参数有
match
The matched substring. (Corresponds to $& above.)
p1, p2, ...
The nth string found by a parenthesized capture group, provided the first argument to replace()
was a RegExp
object. (Corresponds to $1
, $2
, etc. above.) For example, if /(\a+)(\b+)/
, was given, p1
is the match for \a+
, and p2
for \b+
.
offset
The offset of the matched substring within the whole string being examined. (For example, if the whole string was 'abcd'
, and the matched substring was 'bc'
, then this argument will be 1.)
string
The whole string being examined.