DAY13:Mumbling


Posted by birdbirdmurmur on 2023-07-26

題目連結

Mumbling

解法

function accum(s) {
  s = s.toLowerCase();
    let result = '';
    for (let i = 0; i < s.length; i++) {
      result += s[i].toUpperCase() + s[i].repeat(i) + '-';
    }
  return result.slice(0, -1);
}

筆記

避免亂數先全部變成小寫
照著第一個字大寫 後面小寫的規則
使用迴圈來暴力破解
最後刪掉最後一個字


#javascript #Codewars







Related Posts

專題研討心得:Our brawling love for information technologies in the context of XAI(臺大資管系 畢南怡 助理教授)

專題研討心得:Our brawling love for information technologies in the context of XAI(臺大資管系 畢南怡 助理教授)

JS30 Day 2 筆記

JS30 Day 2 筆記

Themeing Windows Terminal With Oh-My-Posh

Themeing Windows Terminal With Oh-My-Posh


Comments