_id);const index = user.bookRecomendations.findIndex( x => x.bookId_id);它在控制台中返回:
[{"bookId":"5b0685e238e2e50ba4c10d49","bookId":"5b0708dbf1079d0dfa98489b&quo
const a = [1,2,1,3,4,1,2];将该数组还原为索引的最javascripty方法是什么,以便从开始到索引的和将超过limitfunctionfindIndex(nums, limit) { for (let [index, num] of nums.entries()) { return index;
我有一个包含数字的基本数组,我遇到了这个问题,我想检查该数组中是否有某个数字,如果是,它返回数字所在的索引。我从一个函数中得到了这个号码。当我运行代码时,findIndex(<number>);会给我一个typeError: <number> is not a function。看看我的代码: return n + 1;vararr = [1