I have a relatively trivial problem, that has caused me to get stumped for a few hours
I am trying to get my button to call a JavaScript function that logs to console
Here is my HTML
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="script.js"></script>
<meta charset="UTF-8">
<title>McKinsey Prep</title>
<div>
<button onclick="click()">Some Button</button>
</div>
</head>
<body>
</body>
</html>
The button here is calling the click() method in this JavaScript file
console.log("Code has reached here")
function click(){
console.log("Button was clicked REEEEe")
}
The script.js file only has this function, I DO NOT want to execute code in my HTML document
When I run my index.js it prints the first print statement but the console.log in the function call does not appear on console when I click my button
NOTE
I am left clicking my index.html and pressing run to run my code.
What could be the issue?