Fibonacci in JavaScript

my JS fibonacci

Note: This was written in 2015.

I recently had an interview where I was asked to code on the fly a small program that output a Fibonacci Series. Well it’s been a long while since I put much thought into mathematics puzzles, not since college, so I was stricken with nervousness. I didn’t do very well and was not called for the 4th interview.

As an engineer, I analyzed this interview and broke down what went awry into actionable parts. The first problem area was I chose my favorite programming language (Java) which I haven’t used in six years. I found that coding is not like riding a bike, you don’t learn once and stay proficient and if you don’t continue to code regularly your skill very quickly goes away. I soon realized this as I opened my latest install of Eclipse IDE and realized the programming language in which I was once fluent, now seemed foreign. I no longer code on a regular basis and when I do its modifying existing code or doing something quick in HTML5 and Java Script. I felt total panic at the white empty project screen.

So even though I did not make it to the next round of interviews I learned a valuable lesson about where my coding skills had atrophied. Armed with this I started filling my spare time coding again. I coded the Fibonacci sequence in the language I have been actively programming in HTML5 and Java Script. I know hindsight 20/20 and all, but I had to prove to myself I could still do it. I used JSFiddle so I could work on it if I was at work, or at home. Below is the result:

JS Fiddle here

If you want to gain experience coding, or try to keep your skills current, I recommend JSFiddle. It is a very useful sandbox accessible from any HTML5 ready browser (I use Chrome). There is also an environment for SQL coding at SQLFiddle both should be accessible from most internet connections. Happy coding.

Written on July 11, 2015