function sub2() 和 var sub2() 和 var sub=function() 都能输出,但有什么区别啊
What is the difference between these expressions? -PHP Chinese website Q&A-What are the differences between these representations? -PHP Chinese website Q&A
Please watch and learn.
function sub2()表示定义一个函数, var sub2()表示定义一个变量,var sub2=function();表示定义一个变量获取方法function()的返回值,但是function是Javascript的关键字不能作为方法名。
What is the difference between these expressions? -PHP Chinese website Q&A-What are the differences between these representations? -PHP Chinese website Q&A
Please watch and learn.
function sub2()表示定义一个函数, var sub2()表示定义一个变量,var sub2=function();表示定义一个变量获取方法function()的返回值,但是function是Javascript的关键字不能作为方法名。