-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmumbling.js
34 lines (31 loc) · 1.02 KB
/
mumbling.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//testing why it's not working (was trying to use >>)
function accum(s) {
let arr = s.split("");
console.log(arr);
// console.log(arr[0].toUpperCase());
let newArray = [];
console.log(newArray);
for (let i = 0; i < arr.length; i++) {
console.log(arr[i].toUpperCase() + " upper case")
console.log(arr[i].toLowerCase() + " lower case")
// console.log(arr[0].toUpperCase() + "second");
console.log(arr[i].toUpperCase() + (arr[i].toLowerCase().repeat(i)));
newArray.push(arr[i].toUpperCase() + (arr[i].toLowerCase().repeat(i)));
console.log(newArray + "newArray");
}
console.log(newArray.join());
// return newArray.join();
}
function accum(s) {
let arr = s.split("");
let newArray = [];
for (let i = 0; i < arr.length; i++) {
newArray.push(arr[i].toUpperCase() + (arr[i].toLowerCase().repeat(i)));
}
console.log(newArray.join());
return newArray.join('-');
}
function accum(s) {
return s.split("").map((a, i) => a.toUpperCase() + a.toLowerCase().repeat(i)).join("-");
}
accum("ZpglnRxqenU");