I tried to write a function on a JS file and another function with the same name in the page.
I expected an error but no error came and I got only the function from the JS file to execute.
How is this possible? Even if I write a function in a separate JS file, everything is rendered in a single html file. Then how come it is possible?
<script type="text/javascript" language="javascript" src="JScript.js"></script>
<script language="javascript">
function Boo() {
alert("Hai new");
}
</script>
<button onclick="Boo();">Click</button>
and in the JS file
function Boo() {
alert("Hai");
}