add(server.tests.test2): 添加实验2的内容,将pdf里面标重要的进行提取出来
This commit is contained in:
16
Server/tests/test2/important/findIndex.js
Normal file
16
Server/tests/test2/important/findIndex.js
Normal file
@@ -0,0 +1,16 @@
|
||||
// findIndex(callbackFn)
|
||||
|
||||
const stus = [
|
||||
{ name: '张三', score: 59 },
|
||||
{ name: '老钟', score: 95 },
|
||||
{ name: 'SB', score: 80 }
|
||||
];
|
||||
|
||||
// 返回第1个满足 score >= 60 条件的索引
|
||||
const rst = stus.findIndex(item => { return item.score >= 60 })
|
||||
console.log(rst)
|
||||
|
||||
/*
|
||||
# node findIndex.js
|
||||
1
|
||||
*/
|
||||
Reference in New Issue
Block a user