We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2e72b4c commit 35cf812Copy full SHA for 35cf812
README.md
@@ -5,8 +5,9 @@
5
- [x] 发布订阅模式
6
- [x] 数组转树
7
- [x] 树转数组
8
-- [x] 生成 x\y 的数组 用 0 填充
+- [x] 生成 x\*y 的数组 用 0 填充
9
- [x] 扁平化数组
10
+- [x] 下划线转驼峰
11
12
## 排序算法
13
面试常见的手写题/07-下划线转驼峰.js
@@ -0,0 +1,17 @@
1
+let str = "create_array_to_save_every_day_price";
2
+
3
+function changeStr(str) {
4
+ const temp = [...str]
+ for (let i = 0; i < temp.length; i++) {
+ if (temp[i] === '_') {
+ temp[i + 1] = temp[i + 1].toUpperCase()
+ temp.splice(i, 1)
+ i--
+ }
+ return temp.join('')
+}
14
15
+const res = changeStr(str)
16
17
+console.log(res);
0 commit comments