Working with the Fibonacci sequence is really enjoyable as it is not bad to do either recursively or iteratively. And having to do it in JS was not painful. Here's one in JavaScript that generates Fibonacci numbers while the length of the sequence array does not equal the given required length:
And a similarly formed algorithm for determining if a given number is a Fibonacci number:
Here's the same solution in Ruby:
Those are all iterative solutions. I think recursive solutions are also lovely!
Except that my solution is, if anything, a line or two longer than the iterative one. So this wouldn't be even a conceptually better or neater solution and since it takes more memory, it'll remain just an exercise.