常用方法

1、字符串中大小写取反

const str = 'aBc'
const newStr = [].map.call(str, item =>{
    return /[a-z]/.test(item) ? item.toUpperCase() : item.toLowerCase()
}).join('')

 

posted @ 2021-11-03 15:12  Echo的前端空间  阅读(15)  评论(0编辑  收藏  举报