Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRodrigo Alarcon
8,028 Pointswhat am i doing wrong?
it says to create a function called sayHi and not put anything inside, but to have the basic structure with an empty code block
function sayHi(
);
<!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>
2 Answers
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsYou're missing the curly braces.
You need opening and closing parentheses AND opening and closing curly braces. Inside the parentheses is where you would put any parameters. In this case there are none but you still need the empty parentheses. Inside the curly braces is where you're going to put the things that the function does.
function sayHi() {
}
Anand Mohan Duddella
Courses Plus Student 8,264 PointsWhen you create a function like function sayHi(
); - You are invoking/calling a function before actually declaring it. To declare a function before calling it please use function sayHi (){
}
I hope then it should work and then you can call it as sayHi();
Sharon Kearney
8,662 PointsSharon Kearney
8,662 Pointsfunction sayHi (){}
don't add a semicolon