# Closure

**URL:** <https://forum.kirupa.com/t/closure/645073>\
**Category:** programming\
**Created:** [November 26, 2020, 3:34am UTC](https://forum.kirupa.com/t/closure/645073 "2020-11-26T03:34:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![closeupman](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/closeupman/32/12919_2.png) [@closeupman](https://forum.kirupa.com/u/closeupman)\
**Post date:** [November 26, 2020, 3:34am UTC](https://forum.kirupa.com/t/closure/645073/1 "2020-11-26T03:34:47Z")

</div>

No error message in console.

The code is exactly as in the book. I only get the good bye and first hello, not the second hello as the book specifies.

Not sure what I did wrong. Thanks.  
\<!doctype html\>

```
<html>

    <head>

        <meta charset="utf-8">

        <title>Closure</title>

        <style>

           

        </style>

    </head>

<body>

    <script>

       function youSayGoodbye() {

        alert("Good Bye!");   

        function andISayHello() {

               alert("Hello!");

        }

        return andISayHello;

       }

       let saySomething = youSayGoodbye();

       saySomething();

    </script>

</body>

</html>
```

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [November 26, 2020, 4:06am UTC](https://forum.kirupa.com/t/closure/645073/2 "2020-11-26T04:06:27Z")

</div>

There should only be one looking at the code. It’s possible there’s a typo in the book. It can be helpful to check for an errata for the book you’re using (if one exists).
