JavaScript JavaScript Basics Creating Reusable Code with Functions Creating a Function

call the new sayHi function you just created

script.js
fuction sayHi() {
alert("Hi");
};
index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
Steven Parker
Steven Parker
170,320 Points

This looks like an exact duplicate of your other question. See the answer(s) posted there.

You can delete this duplicate, click the small rectangle with the 3 dots to reveal that option.