Is there a way to refactor with even a simpler logic?
const monsterFactory = (name, age) => {
return {
name,
age
}
};
is there a way to create an even more refactored logic where if we have arguments, return them as key-value pairs?
Maybe it’s a dumb question but I’m just curious
for example if we were to pass 10 arguments
const foo = (arg1, arg2, …, arg10) => {
return args as key -> value }
without having to write all the arguments again in the body.