我遇到了tslint警告,我对es6还是陌生的,但在语法上仍然有些困难。因此,我不确定如何在箭头函数中转换此代码。
这是我的代码:
let deletedQuestions = origQuestions.filter(function(obj) {
return !updatedQuestions.some(function(obj2) {
return obj.value == obj2.value;
});
});
console.log(deletedQuestions);
let addedQuestions = updatedQuestions.filter(function(obj) {
return !origQuestions.some(function(obj2) {
return obj.value == obj2.value;
});
});
答案 0 :(得分:0)
我相信会
let deletedQuestions = origQuestions.filter(obj =>
!updatedQuestions.some(obj2 => obj.value == obj2.value)) console.log(deletedQuestions);
let addedQuestions = updatedQuestions.filter(obj =>
!origQuestions.some(obj2 => obj.value == obj2.value))
对吗?