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


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s