Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
thanks but why if (!Singleton.a) , why not just define the property without the if statement.
functions are objects, so we are defining the function Singleton and additin a propery 'a'. I've called it 'a' to make a point that its arbitrary, could be named anything. sometimes people name this property instance or instance which makes it look like there is some magic going on, when its not.
So when the funciton is called the first time and 'a' is undefined/falsy we'll store the function in a. So we are storing a reference to the function in a field on the same function, sounds a bit weird but it allows us to consitently return the same (functon) object is all subsequent calls.
can someone please explain how this works?I dont see what the first line is doing.
why are you setting Singleton.a = this? And what is the purpose of this property a?
Please explain, thanks.