I am facing a situation where I need to add the same blocks of code to the start and the end of multiple functions in JavaScript. e.g.
function funcA () {
// code block 1
...
// code unique to funcA
...
// code block 2
...
}
function funcB () {
// code block 1
...
// code unique to funcB
...
// code block 2
...
}
function funcC () {
// code block 1
...
// code unique to funcC
...
// code block 2
...
}
I wonder what is the right pattern to use here to minimize the duplications.