![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JavaScript
JavaScript
TrainTu
写博客可能会是我人生中的一个转折,做了这个决定,是因为不想多年以后才发现在前端的路上毫无痕迹
展开
-
CommonJS的模块化规范和ES6的模块化规范整理
由于开发过程中容易混淆模块化module.exports、exports、export、export default ,作此梳理。CommonJS模块规范和ES6模块规范完全是两种不同的规范:CommonJS模块规范Node应用由模块组成,采用CommonJS模块规范。根据这个规范,每个文件就是一个模块,有自己的作用域。在一个文件里面定义的变量、函数、类,都是私有的,对其他文件不可见。exports 与 module.exportsCommonJS规范规定,每个模块内部,module原创 2021-09-24 15:31:02 · 123 阅读 · 0 评论 -
js修改图片颜色
/** * 根据主题颜色修改图片颜色 * @param {[type]} imgUrl 图片url * @param {[type]} color 主题颜色 * @param {Function} callback 返回值 返回base64 */ changeImageColor = (imgUrl, color = "#00ff7f", callback) => { let threshold = 114; //默认颜色阀值 为 ...转载 2021-10-27 15:51:11 · 3335 阅读 · 1 评论 -
js遍历数组的几种方法及区别
1.for循环2.for...in..循环3.for...of...循环4.forEach5.map原创 2021-11-25 18:03:33 · 302 阅读 · 0 评论 -
event.target 和 event.currentTarget 的区别
event.targetThis property of event objects is the object the event was dispatched on. It is different than event.currentTarget when the event handler is called in bubbling or capturing phase of the event.event.currentTargetIdentifies the current t转载 2021-11-03 17:09:44 · 167 阅读 · 0 评论 -
Promise.any()、Promise.all()、Promise.race()区别记录
Promise.any();有一个子实例成功就算成功,全部子实例失败才算失败;Promise.all();全部子实例的成功才算成功,一个子实例失败就算失败;Promise.race();rece是赛跑机制,看最先的promise子实例是成功还是失败。...转载 2021-09-27 11:50:47 · 524 阅读 · 0 评论