【黄啊码】.substring error: “is not a function”

阅读 61

2023-02-08


var currentLocation = document.location,
muzLoc = currentLocation.substring(0,45),

这时候如果执行,总是无法输出muzLoc,因为本来这个语法就出错了,document.location是一个对象,把一个对象当作字符串肯定是出错的

应该先​​currentLocation​​​​.toString()然后再用截取字符串​

相关推荐

精彩评论(0)

0 0 举报