增强的Function构造函数(Increased Capabilities of the Function Constructor) 在Javascript中Function构造函数可以让你创建一个新函数,不过这个功能并不经常使用.Function构造函数接收函数参数和函数体作为参数,参数都必须是字符串.下面是一个例子: var add = new Function("first", "second", "return first+second"…
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 =…
Rest Parameters: In ES5, when you don't know how many paramters will be passed in, you can use arguments: let sum = function(){ let result = 0; for(let i = 0; i < arguments.length; i++){ result += arguments[i]; } return result; } let result = sum(1,2…