我的控制器中有一个名为myList的对象数组。 我想要一个干净的方式来检查对象数组是否已经有一个特定的id对象。 对象的结构是这样的:在我的代码在控制器 function onInit() {
$log.debug(ctrl);
ctrl.myList.includes = function(id) {
var found = false;
for (v
每一个在我的列表中的元素的一个数组持有的意见,如 for (let i = 0; i < myList; i ++) {
myList[i][‘comments’] = [];
}
我的失败尝试: if (someCondition) {
// insert from index k to the end of the array
myList[‘comment