DEV Community

Cover image for The Breakdown 1
FTWCougar
FTWCougar

Posted on

The Breakdown 1

"It is not enough for code to work." - Robert C Martin.

Understanding the code is just the beginning of your long sought out journey. Being able to breakdown every component of your code and explain what each part does and how it does that is a very important skill you'll need to continue with coding. If your not able to do this, it will then likely take you longer to debug you code. You'll get lost and the sauce and stress out over what is going wrong. I'll demonstrate some basic code that can be broken down.

We'll break down a basic function setup

const basicFunction = ("Parameter") => {
//Your Code Goes Here
}
Enter fullscreen mode Exit fullscreen mode

First the const. The const is short for constant and it means the number or in this case function doesn't change.

Secondly the name (basicFunction) of the function is a name that you'll use to invoke that function (basicFunction()) be careful not to put that name in a infinite loop.

Lastly the Parameter is something that you pass in when you invoke the function (basicFunction(parameter)). It's typically data that you want the function to manipulate generally user input triggers functions you wanna manipulate data with.

And that is the breakdown of a function. I hope this helped some of you understand the code a little better and with this knowledge you use it to write better code so that you understand it and others reading it do too.

Top comments (0)