i have an object that needs to be passed to the method. most often this object will be the same but sometimes should change to the value that the calling method provides
consider i have the method called_method
called_method = () => {
const output = {
key1: "value1";
}
return output;
}
If the method is called like below
called_method();
it should take the output value like in the method
but if it is called something like const output2 = { key2: "value2", } called_method(output2);
then it should consider returning output2. how can i do it?
we have defaulting argument in method to some value. how can i do the ssame with objects. thanks