摘要: 归并排序是一种效率很高的算法,是一种把数组不断切分成小数组,排序后组合的算法。 阅读全文
posted @ 2018-08-07 18:12 Esther_Cheung 阅读(1144) 评论(0) 推荐(0) 编辑
摘要: 插入排序——玩扑克牌的算法。 如果站在我后面的你,大于我,你就站在我的位置上,把你的位置让给你后面的牌,后面的也一样做,直到空出一个位置,这个位置给我插入。 阅读全文
posted @ 2018-08-07 16:59 Esther_Cheung 阅读(1218) 评论(0) 推荐(0) 编辑
摘要: 选择排序,——选出最小值然后放在后面。 阅读全文
posted @ 2018-08-07 16:25 Esther_Cheung 阅读(1285) 评论(0) 推荐(0) 编辑
摘要: 冒泡排序是最简单,也是耗时最久的排序。 总而言之——将每一个数字相互比较,然后将较大的数字和较小的数字交换位置,直到最大的数字冒泡出来。 阅读全文
posted @ 2018-08-07 16:20 Esther_Cheung 阅读(148) 评论(0) 推荐(0) 编辑
摘要: var currying = function(fn){var arg = [].slice.call(arguments,1);//获得除了fn之外的参数。return function(){//返回一个函数var newArgs = arg.concat([].slice.call(argume 阅读全文
posted @ 2018-05-12 13:32 Esther_Cheung 阅读(146) 评论(0) 推荐(0) 编辑
摘要: var data = (function(){ var arr=[]; var i = 0; while(i<100){ arr[i]=function(){ return i}(i);i++;} return arr; })();//创建一个有100个数的Arrayvar res=[];funct 阅读全文
posted @ 2018-05-10 12:01 Esther_Cheung 阅读(261) 评论(0) 推荐(0) 编辑
摘要: function aLoop(i=0){ if(i<10){ console.log(i); i++; aLoop(i); }; }; aLoop();//0-9 //___________________________________ for(var i=0;i<10;i++){ console.log(i); }//same results 阅读全文
posted @ 2018-04-17 13:32 Esther_Cheung 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 高阶组件的概念来自于高阶函数————可以接受函数作为参数/返回值的函数。 高阶组件就是可以接受组件作为参数,返回组件的函数。 用法很多,不过可读性较差。 一般会这样用: 实现判断权限,决定返回什么组件。 实现数据处理之后再传递给(要被返回的)组件。 实现装饰器模式的功能。 实现数据请求和组件的分离。 阅读全文
posted @ 2018-04-10 16:28 Esther_Cheung 阅读(131) 评论(0) 推荐(0) 编辑
摘要: javascript是为了成为轻量级的语言而开发的。开发者并没有选择像其他面向对象的语言一样,定义类(class),而是使用了protopype实现继承。 每一个函数在创建时,都会创建它的Prototype. 而这个函数,如果被用来创造实例,则被称为构造函数(constructor)。 在c++语言 阅读全文
posted @ 2018-01-11 12:16 Esther_Cheung 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 0.大意: client——客户端可见范围 scroll——可滚动范围 offset ——偏差。 1.getBoundingClientRect: DOMRect top: 元素顶边距离视口顶边的距离。 left: 元素左边距离视口左边的距离。 right: 元素右边距离视口右边的距离。 left: 阅读全文
posted @ 2017-12-26 16:52 Esther_Cheung 阅读(169) 评论(0) 推荐(0) 编辑