which and how javascript function will be called if we have 2 function declarations with the same name?

前端 未结 6 1445
旧巷少年郎
旧巷少年郎 2021-01-14 04:58

Take a test:


6条回答
  •  孤城傲影
    2021-01-14 05:24

    In this case the interpreter parses the function definitions first and the last function definition wins.

    This question has also been answered at: Ambiguous function declaration in Javascript

    There is also a good article here: http://kangax.github.com/nfe/

提交回复
热议问题