I have a 2 functions:
const fn1 = (1, 2) => {
//do something
}
const fn2 = ({param1, param2, param3}) => {
$(`#id_one`).text(param1);
$(`#id_two`).text(param2);
param3;
}
Calling functions:
fn2({
param1: 'hello',
param2: 'world',
param3: fn1(1, 2)
});
When I call the function above, fn1() is getting called before fn2(). Why is that happening? I need to go through fn2() before fn1().
fn1()has to be resolved in order to assign the property toparam3which is needed in order to create the object, which is passed tofn2. It's all nested. It would perhaps be clearer if you explain why is it a problem thatfn1doesn't need to be called and what you're trying to do in general.