function.prototype

    0熱度

    2回答

    當我使用bind()函數時,遇到了我目前不知道的情況。 有人可以給我和解釋爲什麼這個例子是這樣的嗎? 顯然,傳遞給綁定函數的內聯對象僅在第一次迭代中初始化,然後保留引用。 我是不是能夠找到的有關這個的任何文件,如果你可以點我朝着正確的方向我會:-) class test { addLetter(element) { console.log('addLetter', this.str)

    2熱度

    3回答

    這個挑戰就是擊敗陣列時不定義任何新的功能: // challenge const arr = [1, [2]] const flattened = arr.reduce(/*your code here, no function expressions or declarations allowed*/, []) console.log(flattened) // expected: [1,