I'm trying to build a game and I noticed that for organization it might be better to place some functions inside other functions because they are used in the original function exclusively. For example:
function fn1()
{
fn2();
function fn2()
{
//Stuff happens here
}
}
fn1 gets called many times, and fn1 will call fn2 several times in its execution. When fn1 is called, does fn2 have to be re-processed (for lack of a better word) every time? Am I losing out in terms of performance because of this? Should I place fn2 after fn1 instead, like this?
function fn1()
{
fn2();
}
function fn2()
{
//Stuff happens here
}