完整函数,其convertTemplate()以其余参数作为输入,并返回串联的字符串作为输入,而与作为参数传递给函数的数据类型无关。sample input - convertTemplate('aa',3)output : aa3*/let convertTemplate = (...input)=>{};
2 回答

哔哔one
TA贡献1854条经验 获得超8个赞
您可以使用Array#join()
method,因为它input
是一个数组。虽然,Array#join()
method会在内部将所有元素转换为字符串并进行连接。
let convertTemplate = (...input) => input.join('') console.log(convertTemplate('aa', 3))

森林海
TA贡献2011条经验 获得超2个赞
let convertTemplate = (...input)=>{
return Array.from(input).join("");
};
console.log(convertTemplate('aa',3));
添加回答
举报
0/150
提交
取消