test(1, {tmp: 20}) test({test: 'Ok'}) // function test(...arg) { let v = 100 let o = arg[0] if (arg.length > 1) { v = arg[0] o = arg[1] } console.log(v, o) }