The spread operator (...) allows you to "explode" an array into its individual elements. Spreate an array: console.log([1,2,3]); // [1, 2, 3] console.log(...[1,2,3]); // 1 2 3 Spread out the second array and push that in first array: let first =…
增强的Function构造函数(Increased Capabilities of the Function Constructor) 在Javascript中Function构造函数可以让你创建一个新函数,不过这个功能并不经常使用.Function构造函数接收函数参数和函数体作为参数,参数都必须是字符串.下面是一个例子: var add = new Function("first", "second", "return first+second"…
Rest and Spread Operators.md Why we need rest and spread operators? var showCollections = function(id, ...collection){ console.log(collection instanceof Array); }; showCollections(42, 'movies', 'music'); instanceof The instanceof operator tests wheth…