---
title: "Comment by Murilo Boareto Delefrate on \"Refactoring old code\" | Hashnode"
description: "The article is well written and it has a very good knowledge about how to refactor a code, but I would do this refactoring in a completely different way. If you"
url: "https://hashnode.com/posts/refactoring-old-code/5fffe819c162d710c9b14a49/comment/6001a48636551629d6a7e0cf"
---

[Discussion](https://hashnode.com/posts/refactoring-old-code/5fffe819c162d710c9b14a49)

Comment [Refactoring old code](https://hashnode.com/posts/refactoring-old-code/5fffe819c162d710c9b14a49)

[Murilo Boareto Delefrate](https://hashnode.com/@murilobd)

[Jan 15, 2021](https://hashnode.com/posts/refactoring-old-code/5fffe819c162d710c9b14a49/comment/6001a48636551629d6a7e0cf)

The article is well written and it has a very good knowledge about how to refactor a code, but I would do this refactoring in a completely different way. If you have a static list of items (that is short enough as in the example), why don't you simple create a variable that will be the final resolve as you expect? Why using loops and so on while you could have a simple

```
const newOutput = [
  ['Angular', 3, '#d17a29'],
  ['React', 1, '#da9554'],
  ['Vue', 2, '#e3af7f'],
  ['Next', 1, '#edcaa9'],
  ['HTML', 2, '#f6e4d4'],
  ['Other', 3, '#204e77']
];
```

[Luiz Filipe da Silva](https://hashnode.com/@luizfilipezs)

[Jan 15, 2021](https://hashnode.com/posts/refactoring-old-code/5fffe819c162d710c9b14a49/comment/6001a48636551629d6a7e0cf#reply-6001dd9836551629d6a7e6e4)

[Murilo Boareto Delefrate](https://hashnode.com/@murilobd) this article just gives us an example. Obviously, in a real world case, the algorithm would be complex and the variables could be used in other places along with the code.
