Nested functions refer to the practice of defining a function within another function. These inner functions have access to the variables and
parameters of the outer function, creating a closure.
While nesting functions is a common practice in JavaScript, deeply nested functions can make the code harder to read and understand, especially if
the functions are long or if there are many levels of nesting.
This can make it difficult for other developers or even yourself to understand and maintain the code.
Noncompliant code example
With the default threshold of 4 levels:
function f() {
function f_inner() {
function f_inner_inner() {
function f_inner_inner_inner() {
function f_inner_inner_inner_inner() { // Noncompliant
}
}
}
}
}