/eitje_refactor_challenge

Will you help Messy Max out? Show him how it's done!

Primary LanguageJavaScript

Eitje refactor challenge

Introduction

At eitje we care about the quality of our code.

What constitutes good code is something you can argue about for hours. To us it means that code is at least compact (more lines means more lines to write, debug and maintain) and clear (all code will inevitability be (re)read by others and your future self).

But talking principles is much easier that implementing principles. When we gave our fictitious intern Messy Max a coding challenge, things escalated pretty quickly!

In messy_max_solution.js you can find his solution. While the code functions properly (cheers to Max!), it does not qualify as good code. Will you show him how his code may be refactored?

The challenge

Read the original challenge we gave Messy Max in CHALLENGE.md and his solution in messy_max_solution.js. You may inspect the results of his code by running node messy_max_solution.js {any integer value} in your CLI.

Create a new file my_solution.js where you show how Messy Max's code may be improved, while the return value remains the same. Make a pull request with your solution included and, optionally, a REMARKS.md with an explanation for the choices you made.

Mark's solution

Just for some comfort I enabled typescript support very quickly. It is Run it by issuing the following commands in the root of the project:

yarn install

yarn global add ts-node@latest typescript

ts-node content/my_solution.ts <integer second duration>