FizzBuzz

It sounds like a generic soda loaded with entirely too much caffeine.

FizzBuzz.

It sounds like a description, given in jest, to a singularly nightmarish hair cut.

FizzBuzz.

It could even be a new word to describe that tickling sensation that originates in your nose, but brings tears to your eyes when you drink soda to quickly.

FizzBuzz.

What comes to mind when you hear that word?

Whatever your imagination conjured up (unless you have computer programming experience) I’m certain you did not equate FizzBuzz to gainful employment as a software developer.  Confused?  Read on.

Last week, I was reading a blog when I encountered FizzBuzz for the first time.  In this post, the author was lamenting the multitude of so-called “programmers” who can not, in fact write a program to save their lives!

FizzBuzz is a simple test that the author of the blog post proposed to help separate the “wheat from the chaff” when it comes to finding astute programmers during job interviews.

The test goes like this:

1)  Choose the programming language of your choice.

2)  Get the computer to print out the numbers 1 – 100 on the screen.

3) If the number is a multiple of 3 print out Fizz instead of that number.

4) If the number is a multiple of 5 print out Buzz instead of that number.

5) If the number is a multiple of both 3 and 5 print out FizzBuzz instead of that number.

According to the author of the blog post, people with degrees in computer science have failed this challenge in job interviews!

This astonished me because I could already see the beginnings of a solution using JavaScript.

I have been learning the fundamentals of JavaScript at codecademy.com and to my amazement the very night I first encountered the FizzBuzz challenge on that blog post, it showed up on codecademy.com!

The problem was stated a little differently on codecademy:

1)  Use the JavaScript Programming Language

2)  Get the computer to print out the numbers 1 – 20 on the screen.

3) If the number is divisible by 3 print out Fizz instead of that number.

4) If the number is divisible by 5 print out Buzz instead of that number.

5) If the number is divisible by 3 and 5 print out FizzBuzz instead of that number.

I couldn’t believe it!  I just read about FizzBuzz and here it was!  Here is the solution that I wrote.  There are many possible solutions, mine is elementary but it works.

Screen Shot 2015-04-04 at 8.12.56 PM

I have to admit, I felt pretty good about myself when I got it to work.

Programming computers is a daunting endeavor.  I spend half of my time utterly confused and sometimes depressed when I can’t figure out a challenge.  The other half of my time is spent looking things up on google and StackOverflow.

However when the mist clears and the obfuscating dust settles, a bit of understanding peeks through.

Those are the moments I program for.  I hope that they become more frequent as I continue to learn.

Advertisements

One thought on “FizzBuzz

  1. Fizzbuzz away, Sounja:)

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s