Assert.throws, Why do I need to put the function inside a function

In the example above, i dont understand why i need to put the Rooster.timeAtDawn(hour) inside an anonymous function? what is even the benifit of this???

section link codecademy project

Perhaps this may be useful:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.