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