Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我注意到,在 javascript 中编码时,我在调用它之前或之后声明该函数并不重要。在其他语言中它会导致异常,但是在 chrome 中运行 javascript 时它工作得很好。那是只有chrome,还是正常的?
你所看到的是函数提升的作用:http ://elegantcode.com/2011/03/24/basic-javascript-part-12-function-hoisting