Simple Factorial Interview Task
The code demonstrates some nice effort towards writing good code, so a professional mindset. However, it does have issues, which I'll explain below.

1. Testing input arguments

I believe that you could have done without that, as the point of the exercise is not to check the parameters, but rather to calculate properly the binomial coefficient.

Anyway, your test condition isNaN(parseFloat(n)) &amp;&amp; isFinite(n) &amp;&amp; isNaN(parseFloat(n)) &amp;&amp; isFinite(n) has issues. Firstly, it only tests the value n, and not the value k (this is a typo, but your following tests have not found it, meaning your tests are incomplete). Secondly, you do not check for positive integers. Thirdly, you convert the variables into numbers (fine), but still use the original values thereafter. Finally, if the test fails, then you should probably do something more than return undefined (and document that behavior as well).

2. The factorial function

Your inputs have been checked already, so I think that you should keep this function as simple as possible, e.g.

function factorial(n) {
  if (n &lt;= 1) {
    return 1;
  }
  return n * factorial (n - 1);  
}


... or using the ternary operator (less readable in a recursive algorithm, but some people prefer that form), e.g.

function factorial(n) {
   return n &lt;= 1 ? 1 : n * factorial (n - 1);  
}


3. The algorithm

This is where, I believe, lies the real point of the exercise. The provided formula C(n,k) = n! / [ k! (n - k)! ], if implemented "as is", has duplications. After all, n! contains both k! and (n - k)!, so you'd be calculating k! or (n - k)! twice, which can be quite expensive. You should therefore remove one of them from n! (the most expensive one), depending on k being superior or inferior to n / 2.

4. The tests

The test named "example" should be removed. Either C is a function, and the following tests are enough, or it is not, and their subsequent execution will lead to a runtime error anyway.

The message property is intended as the name of the test, so there is no need to check the value of the pass variable - and so, there's no need for that variable either.

Finally, I believe that the statement tests[test].apply(undefined) was provided to you by the company. This is... not pretty, and quite unnecessary.