我正在做一些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