The simple example of calculating and formatting a bill for a video store opened my refactoring book in 1999. If done in modern JavaScript, there are several directions you could take the refactoring. I explore four here: refactoring to top level functions, to a nested function with a dispatcher, using classes, and transformation using an intermediate data structure. 18 May 2016 Many years ago, wh
![Refactoring a JavaScript video store](https://cdn-ak-scissors.b.st-hatena.com/image/square/e49e3ed2115936a08c0401150b25fd32936cf2ce/height=288;version=1;width=512/https%3A%2F%2Fmartinfowler.com%2Farticles%2Frefactoring-video-store-js%2Fvideo-js_card.png)