重庆熊猫 Loading

随笔分类 -  JavaScript

摘要:const randomString = () => Math.random().toString(36).slice(2); let result = randomString(); console.log(result); 阅读全文
posted @ 2022-10-26 14:35 重庆熊猫 阅读(35) 评论(0) 推荐(0)
摘要://注意:末尾的...未计数哟 const truncateString = (string, length) => string.length < length ? string : `${string.slice(0, length)}...`; let result = truncateStr 阅读全文
posted @ 2022-10-25 09:37 重庆熊猫 阅读(30) 评论(0) 推荐(0)
摘要:注意:仅在浏览器环境下工作 const stripHtml = html => (new DOMParser().parseFromString(html, 'text/html')).body.textContent || ''; let result = stripHtml('<h1>Hi,Pa 阅读全文
posted @ 2022-10-25 09:36 重庆熊猫 阅读(41) 评论(0) 推荐(0)
摘要:const random = (min, max) => Math.floor(Math.random() * (max - min + 1) + min); let result = random(1, 50); console.log(result); 阅读全文
posted @ 2022-10-24 09:00 重庆熊猫 阅读(28) 评论(0) 推荐(0)
摘要:const round = (n, d) => Number(`${Math.round(`${n}e${d}`)}e-${d}`); let result1 = round(1.666, 2) let result2 = round(1.888, 2) console.log(result1); 阅读全文
posted @ 2022-10-24 09:00 重庆熊猫 阅读(26) 评论(0) 推荐(0)
摘要:const reverse = str => str.split('').reverse().join(''); let result = reverse('Panda666'); console.log(result); 阅读全文
posted @ 2022-10-23 09:18 重庆熊猫 阅读(31) 评论(0) 推荐(0)
摘要:const timeFromDate = date => date.toTimeString().slice(0, 8); let result1 = timeFromDate(new Date(2022, 8, 8, 12, 30, 0)); // 12:30:00 let result2 = t 阅读全文
posted @ 2022-10-22 08:01 重庆熊猫 阅读(72) 评论(0) 推荐(0)
摘要:const dayOfYear = (date) => Math.floor((date - new Date(date.getFullYear(), 0, 0)) / 1000 / 60 / 60 / 24); let result = dayOfYear(new Date()); console 阅读全文
posted @ 2022-10-22 08:01 重庆熊猫 阅读(9) 评论(0) 推荐(0)
摘要:const isDateValid = (...val) => !Number.isNaN(new Date(...val).valueOf()); let result = isDateValid("2022-10-10 16:16:00"); // true console.log(result 阅读全文
posted @ 2022-10-22 08:01 重庆熊猫 阅读(51) 评论(0) 推荐(0)
摘要:const dayDif = (date1, date2) => Math.ceil(Math.abs(date1.getTime() - date2.getTime()) / 86400000); let result = dayDif(new Date("2022-8-10 00:00:00") 阅读全文
posted @ 2022-10-21 10:36 重庆熊猫 阅读(52) 评论(0) 推荐(0)
摘要:const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1) let result = capitalize("panda") // Panda console.log(result); 阅读全文
posted @ 2022-09-09 10:25 重庆熊猫 阅读(30) 评论(0) 推荐(0)
摘要:const average = (...args) => args.reduce((a, b) => a + b) / args.length; let result = average(6, 5, 6, 7, 6); // 6 console.log(result); 阅读全文
posted @ 2022-09-09 10:21 重庆熊猫 阅读(47) 评论(0) 推荐(0)
摘要:确定数字是奇数还是偶数 const isEven = num => num % 2 0; let result = isEven(996); console.log(result); 阅读全文
posted @ 2022-09-09 10:18 重庆熊猫 阅读(54) 评论(0) 推荐(0)
摘要://方式1: const merge = (a, b) => a.concat(b); //方式2: const merge = (a, b) => [...a,...b]; //测试 let result = merge(['panda','666'],['panda','666']); 阅读全文
posted @ 2022-09-09 10:17 重庆熊猫 阅读(27) 评论(0) 推荐(0)
摘要:const removeDuplicates = (arr) => [...new Set(arr)]; console.log(removeDuplicates(['p', 'p', 'a', 'n', 'd', 'd', 'a', 6, 6, 6])); 阅读全文
posted @ 2022-09-09 10:14 重庆熊猫 阅读(26) 评论(0) 推荐(0)
摘要:更新记录 转载请注明出处:https://www.cnblogs.com/cqpanda/p/16589917.html 2022年8月18日 发布。 2022年8月15日 从笔记迁移到博客。 PowerShell介绍(Introduction to PowerShell) 介绍(What is P 阅读全文
posted @ 2022-08-18 08:40 重庆熊猫 阅读(345) 评论(0) 推荐(0)
摘要:更新记录 2023年3月8日 完善描述内容。 2023年3月6日 修复有错误的地方。 2022年12月29日 更新初始化表单的几种方式 2022年8月18日 发布。 2022年8月13日 从笔记迁移到博客。 ExtJS教程汇总:https://www.cnblogs.com/cqpanda/p/16 阅读全文
posted @ 2022-08-18 08:39 重庆熊猫 阅读(1231) 评论(0) 推荐(0)
摘要:更新记录 2022年8月17日 发布。 2022年8月13日 从笔记迁移到博客。 ExtJS教程汇总:https://www.cnblogs.com/cqpanda/p/16328016.html 转载请注明出处:https://www.cnblogs.com/cqpanda/p/16587500. 阅读全文
posted @ 2022-08-17 07:44 重庆熊猫 阅读(1427) 评论(0) 推荐(0)
摘要:更新记录 转载请注明出处:https://www.cnblogs.com/cqpanda/p/16587505.html 2022年8月17日 发布。 2022年8月13日 从笔记迁移到博客。 ExtJS教程汇总:https://www.cnblogs.com/cqpanda/p/16328016. 阅读全文
posted @ 2022-08-17 07:44 重庆熊猫 阅读(372) 评论(0) 推荐(0)
摘要:更新记录 转载请注明出处:https://www.cnblogs.com/cqpanda/p/16587398.html 2022年8月16日 发布。 2022年8月13日 从笔记迁移到博客。 ExtJS教程汇总:https://www.cnblogs.com/cqpanda/p/16328016. 阅读全文
posted @ 2022-08-16 07:23 重庆熊猫 阅读(901) 评论(2) 推荐(0)