当前位置:网站首页>typeScript-部分应用函数
typeScript-部分应用函数
2022-08-04 22:44:00 【MXM_777】
function IsgoodNumber(a:number,v: number){
return v % a ===0
}
function filterArray(a:number[],f:(a:number,b:number)=>boolean){
return a.filter(f)
}
//举例
function ccc(f:(a:number,b:number)=>boolean,a:number){
return (b:number)=>{
return f(a,b)//a是自由变量
}
}
const goodnum =3
const a = [1,2,3,4,56,7,9]
// console.log(a.filter((v)=> v%2 ===0))
console.log(
filterArray(a,(v)=>IsgoodNumber(goodnum,v))
)
// console.log(
// filterArray(a,ccc(IsgoodNumber,goodnum))
// )
边栏推荐
猜你喜欢
随机推荐
Use ngrok to optimize web pages on raspberry pi (1)
MySQL的JSON 数据类型1
JVM memory configuration parameter GC log
【游戏建模模型制作全流程】ZBrush蜥蜴模型雕刻教程
Acwing3593. 统计单词
How to make a video gif?Try this video making gif artifact
[Paper Notes KDD2021] MixGCF: An Improved Training Method for Graph Neural Network-based Recommender Systems
If you can't get your heart, use "distributed lock" to lock your people
QT[一] 信号与槽
FinClip崁入式搭建生态平台,降低合作门槛
BUG | The interface returns abnormal data
智能盘点钢筋数量AI识别
Debian防火墙的开关以及状态
最温馨的家园
边缘检测——(纯享版)
剑指 Offer | 03. 数组中重复的数字
Service Mesh落地路径
As hot as ever, reborn | ISC2022 HackingClub White Hat Summit was successfully held!
备战9月,美团50道软件测试经典面试题及答案汇总
temp7777









