1 const fn = (...args) => { 2 console.log(...args) 3 } 4 5 const handleEval = (fnName,...args) => eval(`${fnName}(${args.map(item => JSON.stringify(item)).join(',')})`) 6 7 handleEval('fn',[1,2,3],{name:'zhangsan',age:18},4,5,'string') // [ 1, 2, 3 ] { name: 'zhangsan', age: 18 } 4 5 'string'