0
在觀看http://www.youtube.com/watch?v=b0EF0VTs9Dc,我發現這樣的javascript代碼的Javascript 「...」 參數
function unit(value) {
var monad = Object.create(prototype);
monad.bind = function (func, args) {
return func.apply(undefined,
[value].concat(
Array.prototype.slice.apply(args || [])));
}
return monad;
}
被改寫爲
function unit(value) {
var monad = Object.create(prototype);
monad.bind = function (func, args) {
return func(value, ...args);
}
return monad;
}
的不過後者並沒有在Chrome和Firefox中運行(我沒有嘗試IE)。這是JavaScript中的新東西,目前的瀏覽器還不支持?
[其餘的力學參數(HTTPS://developer.mozilla .org/en-US/docs/Web/JavaScript/Reference/rest_parameters) - 適用於Firefox Aurora/Nightly。你也可以[聽](https://gpodder.net/podcast/a-minute-with-brendan/the-arguments-argument-2)或[watch](http://vimeo.com/27911873)Brendan Eich說說它 –