Step 2

		
			function pseudo(func) {
				return recFunc((...arg) => {
					return func(func)(...arg)
				})
			}
		
	

Pseudo is our child function of the Y-Combinator that allows us to apply the function we are building. As shown in the previous step, we can pass a function to itself to simulate recursion, but we now need to apply the function to the necessary parameters in order to actually create a useful recursive function.

To start off, you can see that pseudo uses nearly the exact same line as recursion, return func(func)(...arg). This is so that we can use build imitated recursion into the application of the function without having to call the recursion function, as this would not be possible in a language that does not allow recursive calls.

Continuing down the stack, we find the first call to the recFunc parameter, the only parameter to the Y-Combinator and the declaration of the function that requires recursion. As is seen in both this function call and the previously discussed call, the JavaScript rest parameter (written as an ellipsis) is imperative to writing the Y-Combinator in this form while also allowing for recursive functions with multiple parameters. This would not be necessary if we were to write out the function in a more drawn out style, or were only to support single argument functions, but this allows us to do so in a concise manner. In a function declaration it accepts multiple parameters be wrapped into heterogeneous list of an undefined length, and in a function call, it expands a list into multiple arguments. This is necessary so that we can take in more than just the first parameter as well as pass separated parameters rather than just a list of arguments.

More information on the JavaScript rest operator can be found within the language's documentation