-2
以下の文脈で(a =>)は何をしますか?=> doとは何ですか?また、以下の文脈では何を呼びますか?
function findOutlier(int){
var even = int.filter(a=>a%2==0);
var odd = int.filter(a=>a%2!==0);
return even.length==1? even[0] : odd[0];
}
以下の文脈で(a =>)は何をしますか?=> doとは何ですか?また、以下の文脈では何を呼びますか?
function findOutlier(int){
var even = int.filter(a=>a%2==0);
var odd = int.filter(a=>a%2!==0);
return even.length==1? even[0] : odd[0];
}
これらを太矢印機能といいます。この場合には、それらはある
int.filter(function(a){ return a%2==0});
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
と同じです[矢印機能。(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions)私は良い感じを得るために[この質問](http://stackoverflow.com/questions/34361379/arrow-function-vs-function-declaration-expressions-are-theequivalent-exch)を読むことをお勧めしたい彼らのために。 –