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 trial

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

Victor Gordian
Victor Gordian
4,656 Points

It doesn't let me pass

in challenge 2/3 it says: Inside the sayHi() function add the code to make an alert appear with the word "Hi" in it. The alert command should go inside the function's code block.

so i put

function sayHi () { alert(sayHi); }

and then it says: Oops! It looks like Task 1 is no longer passing. so i go back click check work and it pass's...is this some sort of glitch?

2 Answers

I have often gotten the error message "Oops! It looks like task 1 is no longer working" if I introduce a syntax error while working on step 2. It is quirky. Looks like your alert message should be in quotation marks like this: <code> function sayHi () { alert('Hi'); } </code>

Victor Gordian
Victor Gordian
4,656 Points

whoops i didnt read that it said "hi" not the function.

That's interesting that the challenge program won't recognize the syntax error! I was completely thrown when it said that challenge 1 wasn't passing anymore.

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