0
点赞
收藏
分享

微信扫一扫

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


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

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

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

举报

相关推荐

0 条评论