Last updated
Last updated
Every function (also an object) has two properties:
length
refers to the amount of arguments
e.g. function myFunction(x,y,z)
has a length
of 3
prototype
refers to all the properties and methods that the object can use
We can return
more than one object from a function:
In ES6, we can use destructuring as such, to make using this array easier:
Recursive functions can call themselves:
We can easily see that this would result in an endless loop - like a dog chasing its tail!
So, to work like a (sane) normal function, a recursive function must have an exit condition:
The exit condition in the above is the silent else
branch which lets the function not call itself again :)
looking at the details of a JavaScript function