当前位置:网站首页>JS-常用方法整理
JS-常用方法整理
2022-08-09 09:11:00 【云胡不喜?】
// TODO 整理原理
ES6中有一些直接写好的方法
//判断某字段在数组中的位置
indexofArray(arr:any, obj:any) {
let i = arr.length;
while (i--) {
if (arr[i] === obj) {
return i;
}
}
}
//判断数组中是否包含某字段
contains(arr:any, obj:any) {
let i = arr.length;
while (i--) {
if (arr[i] === obj) {
return true;
}
}
return false;
}
2.JavaScript Array filter() 方法
边栏推荐
猜你喜欢
The difference between big-endian and little-endian storage is easy to understand at a glance
绝了,这套RESTful API接口设计总结
法院3D导航系统-轻松实现室内实时定位导航
支付宝小程序使用自定义组件(原生)
零搜索量的关键词,你需要布局吗?
【培训课程专用】RPC模型:代码导读
微信小程序获取用户收货地址列表wx.chooseAddress
数据库期末复习这一篇就够了(期末预习大概也行)
QT program generates independent exe program (pit-avoiding version)
MySQL查漏补缺(五)不熟悉的知识点
随机推荐
【场景化解决方案】OA审批与用友U9数据集成
TypeScript Brief (1)
firefox e.path无效
常用SQL server语句
往二维数组追加键值
关于指针、地址的大小的问题(以及malloc的用法)
SQL语言中的distinct说明
【场景化解决方案】搭建数据桥梁,Dslink打通泛微系统连接流
Some of the topics in VNCTF2021 are reproduced
C#学习笔记
【场景化解决方案】ERP系统与钉钉实现数据互通
MVCC多版本并发控制
【培训课程专用】CA/TA调用模型-代码导读
对于栈、递归的关系的理解
无符号整数文法和浮点数文法
Flutter的基础知识之Dart语法
The 5th Blue Cap Cup preliminary misc reappears after the game
centos7 mysql异常ERROR 2002 (HY000)分析解决
Tencent cloud server is modified to root login to install pagoda panel
编程memonic chant、trick