报错Uncaught ReferenceError: cannot assign to function call的解决方法

var precontent = document.getElementById("preview").value;
precontent.slice(2) = 'hello'

猜想是因为precontent类型是变量,而只有string才有slice方法

posted @ 2022-07-07 22:01  树叶本子  阅读(357)  评论(0)    收藏  举报