Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Creating Reusable Code with Functions Creating a Function

Challenge task 3 0f 3 keeps giving me a communication error.

I have been dealing with the teamtreehouse support team due to a communication error I keep receiving whenever I submit the 3rd step of this challenge. The support person hasn't been able to figure out why I keep getting this message. I use Google Chrome usually. I have cleared browser cache, tried different browsers, restarted computer, tried on other computers, checked security settings...This error first happened a week ago and I have since finished the remainder of the material in this Javascript course. I can't move onto the next part of this track until this passes. I was asked to submit this and make sure it isn't due to my code being incorrect. Please I hope someone can help as I would like to move past this! Thank you.

script.js
function sayHi() {
  alert("Hi");
  sayHi();
}
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>

2 Answers

Sam Baines
Sam Baines
4,315 Points

Hi Holly - you are almost there with the code, it should be:

function sayHi() {
  alert("Hi");
}

sayHi();

You need to call the function outside of the code that runs inside the function itself.

Thank you so much Sam!! Such an easy thing to mess up and without the usual alert "Bummer..." I had no clue. Cheers for your speedy response. I can now move on.

Sam Baines
Sam Baines
4,315 Points

Not a problem and a more common mistake than you might think.