JS 递归 今日同事遇到递归问题 function isExpandedLeftCategory(node) { ..... if (A==B) { return true; } else { for (var i = 0; i < childrenList.length; i++) { ...
Js call apply bind区别 参考https://github.com/lin-xin/blog/issues/7Call/ApplyECMAScript 规范给所有函数都定义了 call 与 apply 两个方法区别:两者区别在于所传参数不一样,apply参数是单个数组,call是一系列参数;作用:改变了this的指向;借用其他函数的方法,比如常用的Array,property....
Js 原型和原型链 首先,JS的继承是用原型链实现的,和传统java里拷贝属性和方法到子类里不一样。1. 原型 原型呢,他其实就是一个对象,目的是为了让实例共享属性和方法,毕竟实例之间是有共性的。2. 原型链 当我们查找一个对象的属性或者方法的时候,如果本身没有,则会去原型对象查找,如果还没有,则去原型对象的原型对象,如此直到找到或者返回undefined;这是一个链式的查...
重新认识button disabled属性 通过setAttribute()设置禁用为false,依然是禁用状态。因此,disabled =“true”,disabled =“disabled”和disabled =“false”都是一样的结果;而应该用下面两种方式:1.element.removeAttribute("disabled");2.element.disabled = false; ...
英语笔记3 1. miss the point It sounds like someone does not understand something, and that's exactly what "miss the point" means. I'm not sure. Can you explain it again? I think I missed the point....
Gulp 笔记 场景:删除之前生成的dev下代码,将html img压缩,js css压缩合并;遇到三个问题,整理如下:1.Gulp 4.0 1.1gulp-sequence gulp4.0不支持gulp-sequence,采用了gulp.series让task顺序执行,更加简单; 异步就采用gulp.parallel拉;let prod = gul...
Eslint Airbnb 参考:https://juejin.im/entry/5b2604cd6fb9a00e4f74c30c1、npm install eslint-config-airbnb -g精彩的重头戏来了:看到漂亮的airbnb了吗?我们就里就是要安装Airbnb的标准了。注意-g,还是全局化安装。2、npm install eslint-plugin-jsx-a11y -ga1...
Js new 过程解析 fucntion Animal(name){ this.name = name;}Animal.size = "middle";Animal.property.say = function(){ console.log(this.name + 'say');}var cat = new Animal('coco'); 上例代码中An...
JS blur和click 顺序冲突 1. click & blur blur和focus事件不会冒泡,其他表单事件都可以 click事件;所有元素都有此事件,会产生冒泡 一个元素失去焦点,blur事件优先于click事件 开发中遇到下拉框blur和click事件冲突,导致不能正常选中值;原因是js单线程,一次只能执行一个事件;可以有两种解决办法: 1-1 b...
mxgraph 画布 画布自动扩大/缩小计算://得到所拖拽图形相对于画布的位置(-880,-100)var x = Math.ceil(bounds.x / this.view.scale - this.view.translate.x);var y = Math.ceil(bounds.y / this.view.scale - this.view.translate.y);//根据缩...
JS字符编码----ASCII,Unicode 和 UTF-8 转:http://www.ruanyifeng.com/blog/2007/10/ascii_unicode_and_utf-8.html1.ASCII 码八个二进制位就可以组合出256种状态,这被称为一个字节(byte)使用7 位二进制数(剩下的1位二进制为0)来表示所有的大写和小写字母,数字0 到9、标点符号, 以及在美式英语中使用的特殊控制字符。其中最后一位用于奇偶...
JS 随机数 参考:https://www.cnblogs.com/wisewrong/p/10517532.html参考知乎回答:https://www.zhihu.com/question/228181041. random, 伪随机数2.sort重排,取其中3.洗牌算法4.9301, 49297, 233280神数字,线性同余生成器,Hull-Dobell定理v...
英语笔记1 1. kick off其实kick off源自于足球,就是开球,发球的意思。引申为“开始做某事”的意思kick-off meeting,kick-off partyCandidates kick off their campaigns with a speech.Students kick-off the semester with a party!2....
SVG 浏览器支持 可以参考以下链接:https://caniuse.com/#search=svghttps://en.wikipedia.org/wiki/Comparison_of_layout_engines_%28Scalable_Vector_Graphics%29https://voormedia.com/blog/2012/10/creating-svg-vector-gr...
Js 数组去重 参考:https://www.cnblogs.com/wisewrong/p/9642264.html推荐以下去重方法,效率高1.ES6 利用set去除2.for of+object转载于:https://www.cnblogs.com/ljyqd/p/11101689.html
JS String fromCharCode/charCodeAt 1.String.fromCharCode() 静态String.fromCharCode()方法返回由指定的UTF-16代码单元序列创建的字符串。 newStr += String.fromCharCode(((str[i].charCodeAt(0) - 18) % 26) + 97) 2.charCodeAt() 返回值是一表示给定...
英语笔记2 1.opt forWould you opt for an expensive luxurious car or a reasonable but practical car?Would you opt for further study abroad or a well-paid job? No, you can opt for only one2.to use re...
SVG 基础 转载链接:http://www.ruanyifeng.com/blog/2018/08/svg.html存在的问题:采用Object引用的时候,contentDocument is null, 目前还米有解决办法,解决了再来更新。转载于:https://www.cnblogs.com/ljyqd/p/11007772.html...
Mxgraph 笔记1 1. mxgraph 图形存储//查看图形的xml document.body.appendChild(mxUtils.button('View XML', function() { var encoder = new mxCodec(); var node = encoder.encode(graph.getModel()); ...