如何创建函数以给出该结果
How to create the function to give that result
需要创建将接管所有参数的函数,我不明白 [1].a(3)
的哪一部分
const add = () => {
}
add(1)(2)[1].a(3) // 1+2+3 = 6
const add = (first) => {
return (second) => {
return [
undefined,
{
a: (third) => first + second + third
}
];
}
}
let result = add(1)(2)[1].a(3);
console.log(result);
:)
需要创建将接管所有参数的函数,我不明白 [1].a(3)
的哪一部分const add = () => {
}
add(1)(2)[1].a(3) // 1+2+3 = 6
const add = (first) => {
return (second) => {
return [
undefined,
{
a: (third) => first + second + third
}
];
}
}
let result = add(1)(2)[1].a(3);
console.log(result);
:)