.toLowerCase not working, replacement function?

后端 未结 5 630
感动是毒
感动是毒 2020-12-29 01:14

The .toLowerCase method is giving me an error when I try to use it on numbers. This is what I have:

var ans = 334;
var temp = ans.toLowerCase();         


        
5条回答
  •  忘掉有多难
    2020-12-29 01:35

    .toLowerCase function only exists on strings. You can call toString() on anything in javascript to get a string representation. Putting this all together:

    var ans = 334;
    var temp = ans.toString().toLowerCase();
    alert(temp);
    

提交回复
热议问题