Unable to find the number of Chinese characters of the string correctly

wrote a function to calculate the number of characters in the input string. When checking whether there is a Chinese character, there is a problem. After entering a string and entering two Chinese characters successively, the second Chinese character will be counted as 1 character.
the output result is as follows:

clipboard.png

here is the code for the check section

 function find(){
            var oform = document.forms[0];
            var msg = oform.elements["msg"].value;
            var sum = 0 ;
            var reg = new RegExp("[\\u4e00-\\u9fa5]","g");
            for(var i = 0; i < msg.length; iPP){
                if(reg.test(msg[i])){
                    sum += 2;
                }else {
                    sum PP;
                }
            }
            console.log(sum);
        }
``
Mar.01,2021

var reg = new RegExp ("[\\ u4e00 -\\ u9fa5]", "g");
change to

var reg = new RegExp("[\\u4e00-\\u9fa5]");
Menu