我试图重写对象的默认toString方法,下面是代码和问题: this.code = 0;//later on I will set thesethis.name = ""; return this.name + "\t"+ this.code +" \t"+this.anotherFunction();
console.log (Lion.
我有一个日期时间文本,我正在使用javascript日期时间函数toString()将其转换为本地dateTime; var date = newDate(txt);现在javascript的toString方法不接受任何参数。它总是以这样的格式出现-
Tue Aug 26 2014 03:30:34 GMT+0530 (India Standard