相關代碼const contains = (() =>
Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
)();contains(['foo', 'bar'], 'baz'); // => false這是我在阮一峰ES6的教程看到的一個例子,無法理解調用該函數時,參數是如何傳遞的?
ES6中數據的includes的例子無法理解,定義時無設形參,但調用卻能傳遞參數?
慕勒3428872
2018-10-24 12:52:32