Counting upper and lower case characters in a string

后端 未结 7 559
礼貌的吻别
礼貌的吻别 2020-12-19 03:25

First off, I know this is far from professional. I\'m trying to learn how to work with strings. What this app is supposed to do is take a simple text input and do a few thi

相关标签:
7条回答
  • 2020-12-19 04:21

    isUpperCase and isLowerCase are not JavaScript functions.

    You can replace them with something like

    var isUpperCase = function(letter) {
        return letter === letter.toUpperCase();
    };
    
    var isLowerCase = function(letter) {
        return letter === letter.toLowerCase();
    };
    

    There were a lot of syntax errors in your code which you need to check.

    I was also getting confused with all your brackets so instead of using the charAt I just referenced the string like an array. So instead of text.charAt(letters) I used text[letters] which I found easier to read.

    See the full jsFiddle here. I modified your code slightly because jsFiddle doesn't allow document.write

    0 讨论(0)
提交回复
热议问题