Declare two variables in function A, bring them to function B, then bring them back to function A
let funcA = (x = 0, y = 1) => {
console.log(`funcA`,x, y)
return [x, y];
}
let funcB = () => {
let [x, y] = funcA();
console.log(`funcB`,x,y);
funcA(x, y)
}
funcB();let funcA = (values) => {
console.log(`funcA values recieved: `, values)
if(values && values.length) {
console.log(`funcA returning`, values, `\n`)
return values;
}
let x = 0;
let y = 1;
console.log(`funcA returning`, [x, y], `\n`)
return [x, y];
}
let funcB = (values) => {
console.log(`funcB: `, values, `\n`)
return values;
}
console.log(
funcA(funcB(funcA()))
);