Good solutions, @matthurd 
A few observations…
Minimum
You don’t need the second Boolean expression, because if the first Boolean expression evaluates to false
then by default b
must be the lowest. And, in addition, if you leave the second Boolean expression as it is, if both numbers ( a
and b
) are equal, the function will return undefined
. So your final solution should look like this:
function min(a, b) {
if(a < b) return a;
else return b; // removed if(a > b)
}
In addition, you need to actually call the function min
by appending parentheses to the function name, and including two numbers as arguments. As your code stands at the moment you are logging the actual function to the console, instead of the value that it returns!
console.log(min(0, -20)); // => -20
Recursion / Bean Counting
Did you arrive at the same solutions as the model answers, yourself, before looking? If so, really well done!
Unfortunately, the code you’ve posted for both exercises throws an error, because your Recursion is missing a final curly brace, and your Bean Counting has one curly brace too many! 