随笔分类 - JS
摘要:axios 一些关于axios的使用技巧 拦截器 var baseUrl = "http://localhost:19800/api/"; const request = axios.create({ // api 的 base_url baseURL: baseUrl, timeout: 1000
阅读全文
摘要:js 日期扩展方法 addMonth addYear 说明 一直想要c#里面的addMonth,addYear啥的,但是js没有,所以就自己简写了一个 代码 Date.prototype.addMonth=function(val){ let year=this.getFullYear() let
阅读全文
摘要:JS 获取上一个月 const end = new Date(); const start = new Date(); start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
阅读全文
摘要:参考地址 https://www.cnblogs.com/yanbigfeg/p/7346325.html 简单例子 var 找到的对象= 数组对象.find(a=>{return a.对象的属性==i})
阅读全文
摘要:参考地址 https://blog.csdn.net/weixin_40902181/article/details/100302528 代码 String.prototype.endWith = function (endStr) { var d = this.length - endStr.le
阅读全文
摘要:参考链接 https://www.cnblogs.com/jpfss/p/9105119.html
阅读全文
摘要:参考链接 https://www.cnblogs.com/qcloud1001/p/9848619.html
阅读全文
摘要:参考链接 https://www.cnblogs.com/ 原本直接用的是str.replace('old','new'), 在实际的过程中发现,它,竟然只替换一次!!! 全部替换代码:replace(/old/g,'new') ,/g应该就是全部代码了,old那边不需要加引号。如果有特殊字符,则用
阅读全文
摘要:高阶函数学习:filter/map/reduce filter:根据条件筛选返回数组 arr=[10,20,30,40,50] arr.filter(n= {return n arr.map(n= {return n 10}) 结果值:[100,200,300,400,500] reduce:对数组
阅读全文
摘要:参考地址: https://blog.csdn.net/fang_ze_zhang/article/details/81868598 正确写法
阅读全文
摘要:除了对象,数组也可以利用这个方法
阅读全文
摘要:参考地址 https://blog.csdn.net/zhangshuang92/article/details/54407229/ href执行JS https://blog.csdn.net/bingguang1993/article/details/82747448 异常报错 JS代码如下:
阅读全文
摘要:来源地址 https://www.cnblogs.com/xi li/p/11107983.html 在js文件的开头,添加下列代码
阅读全文
摘要:来源:https://blog.csdn.net/Raytheon107/article/details/91975043 假设数据是a 1.typeof 返回一个表示数据类型的字符串,返回结果包括:number、boolean、string、symbol、object、undefined、func
阅读全文
摘要:var date=new Date(object类型参数)
阅读全文
摘要:来源地址:https://www.jb51.net/article/165003.htm // 格式化日期,如月、日、时、分、秒保证为2位数 function formatNumber (n) { n = n.toString() return n[1] ? n : '0' + n; } // 参数
阅读全文
摘要:本文来自于:https://blog.csdn.net/u014316026/article/details/82057217 个人最喜欢第三种,方便。 1 var ary = ['a', 'b', 'c']; 2 //第一种 3 for (var i in ary) { 4 console.log
阅读全文

浙公网安备 33010602011771号