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 trialNicole DeRosie
245 PointsHow do I 'call alert' I am a little confused about this part
Hi Im having a hard time understanding what they mean when they say I did not call alert. Thank you!!
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script>
document.write("Warning!");
</script>
document.write("Warning!");
</body>
</html>
2 Answers
Steven Parker
231,268 PointsWhen you "call" a function, you put the function's name followed by a pair of parentheses. If the function requires any arguments (as this one does), they go inside those parentheses. The code here is calling "document.write" instead of "alert".
Also, you only need to write your code one time, and only between the "script" tags.
Nicole DeRosie
245 PointsI have removed the unnecessary second line. It now looks like this. where am I going wrong? What am I missing? <script> document.write("Warning!"); </script>
Nicole DeRosie
245 PointsNVM, I got it. Thank you. Except I didn't have to write document.write. Just alert
frankgenova
Python Web Development Techdegree Student 15,616 Points<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script>alert('Warning!')</script>
</body>
</html>
frankgenova
Python Web Development Techdegree Student 15,616 Pointsfrankgenova
Python Web Development Techdegree Student 15,616 Pointscheck out:
https://developer.mozilla.org/en-US/docs/Web/API/Window/alert
Code answer below