suppose I define two types:
interface a{
name: string;
color: string;
}
interface b{
age: number;
address: string;
}
can we create a function:
function pass(//capture in groups A: a and B: b){
console.log("group A", A);
console.log("group B", B);
}
const name = "new";
const age= 32;
const color = "red";
color address = "home";
calling: pass(name, age, address, color)
would output:
group A {name: "new", color: "red"}
group B {age: 32, address: "home"}
Basically what I'm trying to do is capture the parameters passed by the user into groups i.e. it groups all parameters passed in a function according to the type specified in the function definition.