Moving code after its already been written

Hi all, just wondering why Im writing code only to move it later into a function. Is this some kind progresson that should be followed or is it specific to FCC?

Learn localStorage by Building a Todo App: Step 37 |

Typically it’s best to write code into functions so you can control when it’s called. As for why the code is being written first, that’s to demonstrate the principle of how it works before proceeding. This project is designed to help you learn how to set a project up step by step.

In the real world, you would realistically write the function first and then fill it in. Hope this answers your questions.

1 Like

Thank you for answering this question, I have a better understanding now. :grinning: