The click button does not display the alert as required

What could be wrong with this code? The click button does not display the alert as required.
a). HTML:

<!doctype html>
<html>
 <head>
   <link rel="stylesheet" href="index.js">
 <title>Learning Javascript</title>

 <meta charset="utf-8" />
 <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
 <meta name="viewport" content="width=device-width, initial-scale=1" />
 </head>

 <body>
  <button id="myButton" name="button">Click here for more!!</button>
</body>
</html>

b). JavaScript:

document.getElementById("myButton").onclick=function() {
  alert("Jambo!");
 }

Did I miss something?