DEV Community

Cover image for Solving the FizzBuzz exercise with TDD
Christian Vasquez
Christian Vasquez

Posted on


Solving the FizzBuzz exercise with TDD

Test-Driven Development (TDD) can be a scary concept to hear at first.

How are you supposed to write code that test your code... even before it even exists?

Well, yeah. It can be done and it's a really awesome way of writing code.

Some of the benefits of TDD are:

  1. The code coverage will (most of the time) be pretty high.
  2. There won't be more tests "to write later".
  3. You can refactor your code with more confidence since there should be a bunch of tests that will make sure you don't break anything.
  4. The code will be testable from the beginning because you would not be able to do it without it from the get go.
  5. Probably a few more that I can't remember right now 🤓

Alright, enough chitchat. I've decided to do it while solving a well-known interview question/exercise named FizzBuzz on this video:

Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.