的大O是Array.protoype.filter
多少?
我查看了文档(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),但无法解决。
小智 10
在)
例子:
var words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
const result = words.filter(word => isBig(word));
function isBig(word){
console.log("called");
return word.length > 6;
}
Run Code Online (Sandbox Code Playgroud)
输出:
“被叫”“被叫”“被叫”“被叫”“被叫”“被叫”数组[“旺盛”,“毁灭”,“现在”]
归档时间: |
|
查看次数: |
3667 次 |
最近记录: |