Skip to content

Commit 37f4d62

Browse files
new commit
1 parent bdb6aed commit 37f4d62

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

30_MexicanWave.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
function wave(str) {
2+
// Your Code goes below
3+
var len = str.length;
4+
var arr = [];
5+
if (len == 0) return arr;
6+
7+
var count = 0;
8+
9+
while (count < len) {
10+
if (str.charAt(count).match(/[a-zA-Z]/))
11+
arr.push(
12+
str.substring(0, count) +
13+
str.charAt(count).toUpperCase() +
14+
str.substring(count + 1, len)
15+
);
16+
17+
count++;
18+
}
19+
20+
return arr;
21+
}
22+
23+
console.log(wave("hello"));

0 commit comments

Comments
 (0)