zzl00770

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

随笔分类 -  js

判断arr数组里的元素是否存在{name:'张三'},
摘要:const arr = [ {name: '李四', name: '王五', name: '张三'}, {name: '李四', name: '王五', name: '张三'}, ]; const hasZhangSan = arr.some(item => item.name '张三'); con 阅读全文

posted @ 2024-07-28 07:01 品味人生nuiapp 阅读(9) 评论(0) 推荐(0) 编辑

将小数转换为整数
摘要:let num = 3.14; // 向下取整let floorNum = Math.floor(num); // 结果为 3console.log("向下取整:", floorNum); // 向上取整let ceilNum = Math.ceil(num); // 结果为 4console.lo 阅读全文

posted @ 2024-07-27 12:02 品味人生nuiapp 阅读(50) 评论(0) 推荐(0) 编辑

js 判断字符串是不是数字
摘要:function isNumeric(str) { return /^\d+$/.test(str); } // 使用示例 console.log(isNumeric("123")); // 输出: true console.log(isNumeric("abc")); // 输出: false 阅读全文

posted @ 2024-07-27 12:00 品味人生nuiapp 阅读(10) 评论(0) 推荐(0) 编辑

js 比较两个日期的大小
摘要:function tab(date1,date2){ var oDate1 = new Date(date1); var oDate2 = new Date(date2); if(oDate1.getTime() > oDate2.getTime()){ console.log('第一个大'); } 阅读全文

posted @ 2024-01-22 17:56 品味人生nuiapp 阅读(12) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示