Last active
October 30, 2020 07:17
-
-
Save ucguy4u/79270ee38cf67db7626c3b783c071d80 to your computer and use it in GitHub Desktop.
Loading the javascript file using blank html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>An empty page</title> | |
<script src="script.js" defer></script> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Regular function, called explicitly by name: | |
function multiply() { | |
var result = 3 * 4; | |
console.log("3 multiplied by 4 is ", result); | |
} | |
multiply(); | |
// Anonymous function stored in variable. | |
// Invoked by calling the variable as a function: | |
var divided = function() { | |
var result = 3 / 4; | |
console.log("3 divided by 4 is ", result); | |
} | |
divided(); | |
// Immediately Invoked Function Expression. | |
// Runs as soon as the browser finds it: | |
(function() { | |
var result = 12 / 0.75; | |
console.log("12 divided by 0.75 is ", result); | |
}()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment