Functions with javascript

i just bought the javascript absolute begginers guide and whenever i put in alert(“hello!”) it turns pink and just ends up with a blank screen and no popup

thanks for helping

Hi Ed! Welcome to the forums :slight_smile:

Can you please share the full code you have in your document?

Thanks,
Kirupa

i just got the book a few days ago this is all i have

<!DOCTYPE html>
<html>


<head>
    <meta charset="utf-8">
    <title>hello</title>


    <style>


    </style>
</head>


<body>
    <script>
        function sayHello() {
            alert("hello!");
        }
       
    </script>
</body>
</html>

You need to call the sayHello function to have it run, as shown below. That should do it :slight_smile:

<script>
    function sayHello() {
        alert("hello!");
    }
    sayHello();
   
</script>

Thanks A lot you were a great help now I can continue the book!

Thanks again!
Edhunt198

1 Like

Glad it worked out :slight_smile:

Feel free to create new topics for any other questions or issues you have, no matter how big or small!