About formatting Here are two scenarios in which the details of the formatting are described. How should in the clean code way, this be formatted
Scenario 1: Dependent functions of dependent functions
function main () {
firstFunction();
secondFunction();
thirdFunction();
}
function firstFunction () {
fourthFunction()
}
function fourthFunction() {}
function secondFunction() {
functionFifth()
}
function functionFifth() {}
function thirdFunction() {}
OR
function main () {
firstFunction();
secondFunction();
thirdFunction();
}
function firstFunction () {
fourthFunction()
}
function secondFunction() {
functionFifth()
}
function thirdFunction() {}
function fourthFunction() {}
function functionFifth() {}
Scenario 2: Multiple functions call the same function
function firstFunction() {
mainFunction()
}
function mainFunction() {}
function secondFunction() {
mainFunction()
}
OR
function firstFunction() {
mainFunction()
}
function secondFunction() {
mainFunction()
}
function mainFunction() {}
For me personally, i would in scenario 1 choose the first way and in scenario 2 the second.
Question: How should the formatting be in this two scenarios ?