I have the following code in my HTML file:
<script src = "js/create.js"></script>
<script>
function show() {
//some code here
}
</script>
In the JavaScript file create.js, I want to call the function show() defined in the block, like this:
//File create.js
var a = show();
So is the function show() accessible in the file create.js?
Yes, you defined the function without putting it in a var so it will be hoisted to the most outer scope being the global scope.
But you run create before that function is declared so it wont see it, turn them around and see.