晴明的博客园 GitHub      CodePen      CodeWars     
摘要: Element.scrollHeight //是计量元素内容高度的只读属性, 包括overflow样式属性导致的视图中不可见内容。//没有垂直滚动条的情况下, scrollHeight值与元素视图填充所有内容所需要的最小值clientHeight相同。//包括元素的padding, 但不包括元素的m 阅读全文
posted @ 2016-02-25 17:01 晴明桑 阅读(371) 评论(0) 推荐(0) 编辑
摘要: Array.prototype.splice()array.splice(start, deleteCount[, item1[, item2[, ...]]]) 只有当deleteCount为0时,item1、item2...这些参数才有意义 //用新元素替换旧元素,以此修改数组的内容。 //改变 阅读全文
posted @ 2016-02-25 02:02 晴明桑 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Object.create() Object.create(proto, [ propertiesObject ]) Object.create() 方法创建一个拥有指定原型和若干个指定属性的对象。 #似乎是更纯净的object #使用Object.create实现类式继承 # Object.pro 阅读全文
posted @ 2016-02-24 13:45 晴明桑 阅读(168) 评论(0) 推荐(0) 编辑
摘要: # 1 //按列访问 2 var grades = [ 3 [89, 77, 78], 4 [76, 82, 81], 5 [91, 94, 89] 6 ]; 7 var total = 0; 8 var average = 0.0; 9 for (var row = 0; row < grades 阅读全文
posted @ 2016-02-24 01:23 晴明桑 阅读(1425) 评论(0) 推荐(0) 编辑
摘要: 排序 sort() 最好在sort()使用使用函数判断,不然遇到相同值时,排序会出错 阅读全文
posted @ 2016-02-23 18:17 晴明桑 阅读(127) 评论(0) 推荐(0) 编辑
摘要: //window.location function parseURL(url) { var a = document.createElement('a'); a.href = url; return { source: url, protocol: a.protocol.replace(':',' 阅读全文
posted @ 2016-02-23 17:47 晴明桑 阅读(128) 评论(0) 推荐(0) 编辑
摘要: ok( truthy [, message ] ) //truthy结果true则显示message信息 1 QUnit.test("ok test", function(assert) { 2 assert.ok(true, "true succeeds"); 3 assert.ok("non-e 阅读全文
posted @ 2016-02-23 16:48 晴明桑 阅读(188) 评论(0) 推荐(0) 编辑
摘要: #宝宝心里苦啊 1 function findMissingNumber(sequence) { 2 // if (typeof sequence != 'string') { 3 // return 0; 4 // } 5 // if (sequence.replace(/\s+/g, '').l 阅读全文
posted @ 2016-02-23 12:54 晴明桑 阅读(225) 评论(0) 推荐(0) 编辑
摘要: (number%1==0)可用于判断是不是整数,小数%1是小数 isNaN()检测 是否是 NaN,因为 NaN!=NaN += -= *= /= Number() 奇巧淫技:+数字 相当于Number(数字 ) parseInt() parseFloat() #parseInt()可用于进制转换, 阅读全文
posted @ 2016-02-22 00:46 晴明桑 阅读(261) 评论(0) 推荐(0) 编辑
摘要: # 工厂模式 缺点: 不能识别对象类型 阅读全文
posted @ 2016-02-21 17:21 晴明桑 阅读(147) 评论(0) 推荐(0) 编辑