Entire JS inside one global variable?

Entire JS inside one global variable?

I've got a school assignment of creating an app and one of the restrictions were that only one global variable was allowed, named "App".

So I need to put the whole JS inside this variable.
I thought of doing something like:

App = function() { this.test = () => alert("test"); }

And then calling it with "App.test()".
But this doesn't work.

Am I doing something wrong?

Submitted August 12, 2017 at 10:38PM by nirtz
via reddit http://ift.tt/2wDGYVH