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 trialjack Sandberg
1,659 PointsWhat is wrong with this course?
I've tried to create a function and put an alert in the function but it still not working.And the workspace does not work at all in ths course ... i've opened it in FireFox and Chrome but still not workig.... what should i do?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script>
Function myfunction{
alert("Warning");
}
</script>
</body>
</html>
2 Answers
Rasbin Rijal
Courses Plus Student 10,864 PointsHi Jack, In your javascript you have define what the function returns. But, you have not called that function. In order to make it work, you should make a function call. To make a function call, you should write the name of your function, opening and closing brackets and a semi-colon at the end outside your function as shown below :
function myfunction{
alert("Warning");
}
myfunction();
Hope this helps :)
Mehmet Ayhan
Courses Plus Student 348 Pointsfunction my_func(){
alert('Something...');
}
my_func();
** Sorry, I don't know how to embed a code. I am new here. Appreciate being reasonable on me.
Jacob Mishkin
23,118 Pointsedited code for formatting.