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 trialZachary Pratt
2,395 PointsCommunication Problems
How do I get pass this problem, that I have been experiencing for the last 24 hrs? I get through the first and second challenge questions and on the third; I get the problem popup.
function sayHi() {
alert('Hi');
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>
3 Answers
Colin Marshall
32,861 PointsYour problem is that you are calling the sayHi()
function inside of itself. Move the function call to outside of the function and you will be good to go.
Jake Lundberg
13,965 PointsYou need to call the function outside the code block. So:
function sayHi() {
alert("Hi");
}
sayHi();
Jonathan Ankiewicz
17,901 Pointsjake you forgot to close you initial function.
sayHi () { alert("Hi"); };
// calling the function here sayHi();
Colin Marshall
32,861 PointsJake's code is correct. It might look funny because it's all on one line, so I'm going to fix that for him.
Jake Lundberg
13,965 PointsWhat do you mean...both curly braces are there....?
Jake Lundberg
13,965 Pointslol thanks Collin...I always forget to do that.
Jonathan Ankiewicz
17,901 PointsSorry about that, I thought the function required a semi-colin
Jacob Mishkin
23,118 PointsIts because you are calling the function inside the function. call the function outside of the brackets and you should be good to go.