JavaScript JavaScript Basics Creating Reusable Code with Functions Returning a Value from a Function

I don't understand what the question is asking

It asks to create a function getYear without putting code in the parenthesis but I'm receiving a syntax error.

script.js
function getYear ()
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>

1 Answer

Steven Parker
Steven Parker
173,537 Points

Even if there's no code in it, the function still needs a function body indicated by a pair of braces {}. The body comes after the parentheses.

That worked! Thanks!