Advanced-Frontend / Daily-Interview-Question

我是依扬(木易杨),公众号「高级前端进阶」作者,每天搞定一道前端大厂面试题,祝大家天天进步,一年后会看到不一样的自己。
https://muyiy.cn/question/
27.43k stars 3.29k forks source link

处理字符串还是replace #550

Open 1596944197 opened 2 years ago

1596944197 commented 2 years ago

let strS = 'zdasdasDHAIHIASdbzxWSFADF'

strS = strS.replace(/.?/g, str => { return str.toUpperCase() === str ? str.toLowerCase() : str.toUpperCase() })