我正在做一些JavaScript練習,我解決了它。但在另一種解決方案,我看到這個...什麼是編碼技術叫?函數[]()
this.queue(
buf.toString()[
nlines++ % 2 === 0? 'toUpperCase' : 'toLowerCase']() + '\n');
凡爲我這樣做...
var line = buf.toString();
this.queue(lineCount % 2 === 0
? line.toLowerCase() + '\n'
: line.toUpperCase() + '\n'
);
傳入[]的功能後,什麼技術叫什麼?
我在swift中看到過類似的東西,如果它們是最後一個參數,就傳遞閉包。我假設它是相同的,但不能在google上找到它,因爲我不知道這些詞。
甚至沒有關閉
'[]'應用於函數調用的結果。 – thefourtheye 2015-02-07 20:04:47