How to create a function and pass in variable length argument list?

前端 未结 1 656
粉色の甜心
粉色の甜心 2020-12-07 04:20

We can create a function p in the following code:

var p = function() { };
if (typeof(console) != \'undefined\' && console.log) {
    p =         


        
1条回答
  •  再見小時候
    2020-12-07 05:04

    You can use Function.apply():

    console.log.apply(console, arguments);
    

    0 讨论(0)
提交回复
热议问题