toUpperCase() is not making the string upper case

前端 未结 6 2226
走了就别回头了
走了就别回头了 2021-02-11 02:48

I don\'t know what I\'m doing wrong; But somehow .toUpperCase() String-function is not working on my browser or do I get something wrong?

var string          


        
6条回答
  •  庸人自扰
    2021-02-11 03:29

    String is Immutable. Once created, a string object can not be modified.

    So here toUpperCase returns a new string, This should work-

    var string ="kjsdgfiIJHBVSFIU";
    var newString = string.toUpperCase();
    alert(newString);
    

提交回复
热议问题