为什么下面的函数封装起来就能正常运行,不封装就会提醒Uncaught SyntaxError: Identifier 'top' has already been declared (at product-dev.html:610:11)
函数作用域的问题,你可能在其他地方也定义了“top”变量,所以导致const top时报错