![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
javascript
jinboliu000
这个作者很懒,什么都没留下…
展开
-
JavaScript中数组遍历方式与中止
不能使用 continue break return 可以跳过本次循环 (类似于 continue)不能使用 continue break return 可以跳过本次循环 (类似于 continue)不能使用 continue break return 可以跳过本次循环 (类似于 continue)// 同理, return true 相当于执行到这里就直接跳过本次的循环。// return false 相当于执行到这里就直接跳过本次的循环。可以使用 continue break 不能使用 return。原创 2023-05-10 12:26:34 · 1447 阅读 · 0 评论 -
跨域插件 Egg Cors
跨域插件 Egg Cors原创 2022-08-15 14:58:53 · 399 阅读 · 0 评论 -
debounce和throttle
搞懂debounce(防抖)和throttle(节流)原创 2022-08-10 17:48:00 · 983 阅读 · 0 评论 -
导出PDF
// 导出页面为PDF格式import html2Canvas from ‘html2canvas’import JsPDF from ‘jspdf’export default {install(Vue, options) {Vue.prototype.getPdf = function (el, cb) {let title = this.htmlTitle;let ele = document.querySelector(el);html2Canvas(ele, {allowTain原创 2021-11-18 16:14:46 · 89 阅读 · 0 评论 -
导出html
let a = document.createElement(“a”);let url = window.URL.createObjectURL(new Blob([document.getElementById(‘pdfDom’).innerHTML], {type: ‘’}));a.href = url;a.download = “file.html”;a.click();window.URL.revokeObjectURL(url);原创 2021-11-18 16:14:10 · 321 阅读 · 0 评论 -
Promise 与 Async/Await
参考:https://segmentfault.com/a/1190000016788484/原创 2021-07-29 11:09:48 · 56 阅读 · 0 评论 -
Set与Map的区别
Set 对象类似于数组,且成员的值都是唯一的。// 数组快速去重const arr = [1, 2, 3, 4, 5, 5, 4, 3, 2, 1];console.log([...new Set(arr)]); //[1, 2, 3, 4, 5]Map 对象是键值对集合,类似于 JSON 对象,但是 key 不仅可以是字符串还可以是对象var map = new Map();var obj = { name: 'ZS', age: 20 };map.set(obj, 'LS');map原创 2021-07-23 13:50:31 · 81 阅读 · 0 评论 -
call、apply、bind三者的用法和区别
转载:https://blog.csdn.net/hexinyu_1022/article/details/82795517原创 2021-07-23 09:19:40 · 81 阅读 · 0 评论 -
JS继承-组合继承
通过调用父类构造,继承父类的属性并保留传参的优点,然后通过将父类实例作为子类原型,实现函数复用// 定义一个动物类function Animal (name) { // 属性 this.name = name || 'Animal'; // 实例方法 this.sleep = function(){ console.log(this.name + '正在睡觉!'); }}// 原型方法Animal.prototype.eat = function(food) { c原创 2021-07-19 19:21:42 · 402 阅读 · 0 评论 -
函数上下文,this指向
1.对象.函数() //this指向调用的对象2.函数() //this指向window3.数组[下标]() //this指向调用的数组4.立即可执行函数,上下文是window对象(function(){})() //this指向window5.定时,延时调用函数,上下文是window对象定时:setInterval(函数,时间)延时:setTimeout(函数,时间)var a = 1;var obj = { a:2, fn: function(){ console.lo原创 2021-07-14 17:14:00 · 124 阅读 · 0 评论 -
find(),findIndex(),indexOf()的用法与区别
1,find()方法返回数组中第一个满足条件的元素,找不到返回undefined 该方法ES6新增。语法: arr.find(callback)callback函数有三个参数。item:每一次迭代查找的数组元素。index:每一次迭代查找的数组元素索引。arr:被查找的数组。var testArr1 = [20,12,362,26,965,22,26,35];var findItem1 = testArr1.find(function(item,index,arr){return item&g原创 2021-05-06 16:46:24 · 600 阅读 · 0 评论 -
深入浅出Object.defineProperty()
参考:https://www.jianshu.com/p/8fe1382ba135原创 2020-08-25 15:48:26 · 126 阅读 · 0 评论 -
Promise
function cutUp(){console.log(‘开始aaa’);return new Promise((resolve, reject) => {setTimeout(() => {console.log(‘aaa完毕!’);resolve(‘获取的aaa的值’);}, 2000);});}function boil(){console.log(‘开始b...原创 2020-05-08 10:35:28 · 294 阅读 · 0 评论