+ 2
Two function with same name having different output on the same page. Which one will take precedence in js
function a(){alert(1);} function a(){alert(2);}
2 Réponses
+ 3
The last one. In this case, it'll alert 2.
When you declare 2 functions with the same name, the last one will overwrite the preceeding one.
+ 3
the one that is defined later!
You can verify it with my code here:
https://code.sololearn.com/WLRK8lr89209/#js