背景: 小明想要用数组的形式为 Cls.func 传入多个参数,他想到了以下的写法: var a = new Cls.func.apply(null, [1, 2, 3]); 然而浏览器却报错Cls.func.apply is not a constructor. 乍一看是 new 操作符去修饰 Cls.func.apply 了,于是他又这么写: var a = (new Cls.func).apply(null, [1, 2, 3]); 浏览器依旧报错...好吧,还是好好查一查相关的解决方法吧…
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title></head><body> <script type="text/javascript"> var test = { a : 5, b : 6, sum : function…