題目連結:
解法:
function DNAStrand(dna){
return dna.replace(/[ACTG]/g, match =>{
switch(match){
case "A":
return "T";
case "T":
return "A";
case "C":
return "G";
case "G":
return "C";
}
})
}
筆記:
替換字先想到replace()
/[ATCG]/g:找到所有A、T、C、G四個字母
switch()將傳遞進來的值通過case轉換成另外一個字
![[4] 測試是一門學問,關於執行測試](https://static.coderbridge.com/images/covers/default-post-cover-1.jpg)

