js 传参

99 阅读1分钟

// 传参数: 值就是copy // 对象 只传递 引用

function test() { let num = 1; for (const el of arguments) { if(typeof el === 'function') { el(num) }else { console.log(el); } } }

function fn(num) { num += 1; console.log('jjm', num); }

test(fn, 'hello', {"js":'params'})