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.
This comment is hidden because it contains spoiler information about the solution
it is not a good idea to make
func
its own context. Betterthis
, so the function context can be set by callingspread
in whatever context you choose.Hi,
Extra info.
In c# we don't have tail call optimization, we need to be careful with the using of recursive methods.
Greetings,
Hilário Cunha
I'm sure you are all right. JS is very confusing at times. A function can not hold a variabel that 'this' can access right? An object (called through the this keyword) can access it's properties via dot-, or bracket notation. Then what's the point of using a function as the object as you have no use for the 'this'?
Let's try to keep the w3schools references to a minimum please...
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects#Object_everything
To complement the info provided by Kamilius.
http://www.w3schools.com/Js/js_object_definition.asp
Hi karlpokus. The thing is, that in javascript literally everything is an object
Hi hilario! Yes. I know. But can that argument (the object to use as this) be a function? Functions are not objects are they?
Yes.
The first parameter of the apply is used to define the value of the "this" in the function.
You can read more in the following link
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply
Can the function be the object calling the function?