使用JavaScript测试字符串中的字母是大写还是小写

zibianqu

关注

阅读 83

2022-02-18

    // 使用JS测试字符串中的字母是大写还是小写
    let mes1 = 'a';
    let mes2 = 'A';
    if(mes1 == mes1.toLowerCase()){
        console.log('lowerCase')  //小写
    }
    if(mes1 == mes1.toUpperCase()){
        console.log('upperCase')  //大写
    }

精彩评论(0)

0 0 举报