会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
마지막 그 한마디
Admin
2016年7月25日
React
ReactDOM.render 1. render 多次子组件时,getInitialState 触发多次 2. render 多次子组件时,getDefaultProps 触发一次
Read More
posted @ 2016-07-25 15:59 koala_熊
Views(111)
Comments(0)
Diggs(0)
2016年7月18日
链表
// 单向链表 function LinkedList() { this.head = {element: 'head', next: null}; this.node = function (node) {return {element: node, next: null}}; // 查找 this.find = function (node) { ...
Read More
posted @ 2016-07-18 13:42 koala_熊
Views(114)
Comments(0)
Diggs(0)
2016年7月16日
map, set
// set实现数组去重 function dedupe(arr) { return Array.from(new Set(arr)); }
Read More
posted @ 2016-07-16 11:10 koala_熊
Views(88)
Comments(0)
Diggs(0)
2016年7月12日
二叉查找树
var obj = new BinaryTree(); obj.add(0); obj.add(2); obj.add(1); obj.add(3); obj.add(4); obj.add(8); obj.add(1); obj.add(-3); obj.add(-2); obj.add(-7);
Read More
posted @ 2016-07-12 18:03 koala_熊
Views(131)
Comments(0)
Diggs(0)
2016年7月8日
数制间的相互转换
function mulBase(n, base) { var base16 = [{10: 'A'}, {11: 'B'}, {12: 'C'}, {13: 'D'}, {14: 'E'}, {15: 'F'}]; var arr = []; var res = ''; while (n > 0) { arr.push(n % base); ...
Read More
posted @ 2016-07-08 16:05 koala_熊
Views(116)
Comments(0)
Diggs(0)
2016年7月7日
二维数组
// 创建二维数组 Array.matrix = function (rows, cols, initial) { var arr = []; for (var i = 0; i < rows; i++) { var column = []; for (var j = 0; j < cols; j++) { column[j...
Read More
posted @ 2016-07-07 18:48 koala_熊
Views(117)
Comments(0)
Diggs(0)
2016年7月6日
拖拽
// (来自JavaScript高级程序设计) 自定义事件 function EventTarget() { this.handler = {}; } EventTarget.prototype = { constructor: EventTarget, // 添加事件 addHandler: function (type, fn) { i...
Read More
posted @ 2016-07-06 15:56 koala_熊
Views(222)
Comments(0)
Diggs(0)
自定义事件
// (来自JavaScript高级程序设计) 自定义事件 function EventTarget() { this.handler = {}; } EventTarget.prototype = { constructor: EventTarget, // 添加事件 addHandler: function (type, fn) { i...
Read More
posted @ 2016-07-06 14:36 koala_熊
Views(135)
Comments(0)
Diggs(0)
2016年7月5日
函数节流
// (来自)JavaScript高级程序设计 不支持匿名函数 function throttle(fn, context) { clearTimeout(fn.tId); fn.tId = setTimeout(function () { fn.call(context); }, 100); } // (来自)百度 不支持匿名函数 function ...
Read More
posted @ 2016-07-05 20:03 koala_熊
Views(102)
Comments(0)
Diggs(1)
2016年6月30日
public.js
'use strict'; // 获取CSS function getStyle(obj, attr) { return (obj.currentStyle || getComputedStyle(obj, false))[attr]; } // 设置CSS function setStyle(obj, attr, val) { switch (typeof attr) ...
Read More
posted @ 2016-06-30 11:47 koala_熊
Views(1341)
Comments(0)
Diggs(0)
下一页