 # Is this an example of a helper function?

does my creation applies for helper function?
calling sideB() function, in which the result of sideA() is divided by 5, as the result of two digits multiplying in sideA () func.

``````function sideA(param1, param2){
const part1 = param1*param2;
return part1;
}

function sideB(){
const part2 = sideA(1023,3)/5;
console.log(part2);
}

sideB();

``````

A helper function is generally a utility that handles one step of a computation. Yours above is simply multiplying two values, so should have a name that expresses that since it is usable by any part of your program. `sideA` is a bit more descriptive than it needs to be, and does not speak to what the helper function actually does.

``````const product = (a, b) => a * b;
``````

Now in your sideB function,

``````const sideB = () => {
console.log(product(1023, 3) / 5);
}
``````

Now we get to another minor concern… Number literals in a function. If our aim is to have constants at work, then we should define them as `const` and give them a name that describes what concept the number represents.

1 Like

thanks, I guess I’m done for today, tty tomorrow

1 Like