What is the difference between call and apply?

前端 未结 24 1666
太阳男子
太阳男子 2020-11-21 07:12

What is the difference between using call and apply to invoke a function?

var func = function() {
  alert(\'hello!\');
};
         


        
24条回答
  •  名媛妹妹
    2020-11-21 07:56

    The difference is that call() takes the function arguments separately, and apply() takes the function arguments in an array.

提交回复
热议问题