随笔分类 -  JavaScript

JS相关知识点
摘要:子串(定义):字符串中任意个连续的字符组成的子序列称为该串的子串。 /** * 通过for循环判断A是否为B的子串 * @param {String} comp - 被对比的字符串(B) * @returns {Boolean} */ String.prototype.isSubStrOf = fu 阅读全文
posted @ 2021-04-15 10:59 樊顺 阅读(303) 评论(0) 推荐(0) 编辑
摘要:function MinStack() { this.stack = []; this.helperStack = []; this.len = 0; this.helperLen = 0; } MinStack.prototype.push = function(v) { this.stack.p 阅读全文
posted @ 2021-04-05 23:55 樊顺 阅读(38) 评论(0) 推荐(0) 编辑
摘要:Array.prototype._reverse = function() { const len = this.length; const mid = Math.floor(len / 2); // l: left pointer; r: right pointer; let l = 0, r = 阅读全文
posted @ 2021-04-05 22:50 樊顺 阅读(254) 评论(0) 推荐(0) 编辑
摘要:JS数组去重 阅读全文
posted @ 2021-04-05 21:55 樊顺 阅读(68) 评论(0) 推荐(0) 编辑
摘要:encodeURIComponent可以转义除了以下字符外的任意字符: // 不转义的字符 A-Z a-z 0-9 - _ . ! ~ * ' ( ) encodeURIComponent和encodeURI 有以下几个不同点: var set1 = ";,/?:@&=+$"; // 保留字符 va 阅读全文
posted @ 2021-03-31 14:50 樊顺 阅读(492) 评论(0) 推荐(0) 编辑
摘要:1. 通过回调函数 <SomeComponent ref={thisComp => this.yourCompRef = thisComp} /> 2. 通过createRef函数 const currentRef = React.createRef(); <SomeComponent ref={c 阅读全文
posted @ 2020-11-29 13:09 樊顺 阅读(225) 评论(0) 推荐(0) 编辑
摘要:在 Create React App 工程中样式使用less modules 阅读全文
posted @ 2020-11-24 10:53 樊顺 阅读(2619) 评论(1) 推荐(0) 编辑
摘要:个人所负责的一个项目,需要兼容IE11,所以已经按照react-app-polyfill官方指定的方案进行兼容配置即在项目src/index.js中: // The first lines in src/index.js import 'react-app-polyfill/ie11'; impor 阅读全文
posted @ 2020-01-11 11:05 樊顺 阅读(2879) 评论(0) 推荐(0) 编辑
摘要:关于XMLHttpRequest 开发者使用XMLHttpRequest对象与服务端进行交互(发送http请求、接受返回数据等),可以在不打断用户下一步操作的情况下刷新局部页面。XMLHttpRequest在Ajax中被大量使用。 XMLHttpRequest被应用时的处理机制 (图片来源:deve 阅读全文
posted @ 2019-03-21 14:21 樊顺 阅读(259) 评论(0) 推荐(0) 编辑
摘要:JS继承、this、异步 阅读全文
posted @ 2019-01-09 14:10 樊顺 阅读(121) 评论(0) 推荐(0) 编辑
摘要:1. 在用||做条件判断时,如果情况较多,我们可以考虑是否能够用Array.includes()方法代替 2. 默认参数和参数的解构 阅读全文
posted @ 2019-01-07 13:36 樊顺 阅读(87) 评论(0) 推荐(0) 编辑
摘要:JavaScript,prototype 阅读全文
posted @ 2018-11-17 23:47 樊顺 阅读(304) 评论(0) 推荐(0) 编辑

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