晴明的博客园 GitHub      CodePen      CodeWars     
摘要: let 可替代 var 声明变量,但 let 声明的变量只在它所在的代码块有效。 特别适用于 for()循环中。 这是分割线 const 声明常量,常量无法被改变。 这是分割线 箭头函数(=>) function friend = friends => friends.filter(friend = 阅读全文
posted @ 2016-02-04 11:40 晴明桑 阅读(82) 评论(0) 推荐(0) 编辑
摘要: #通用封装方法 #JS简易写法 console.log(object[, object, ...])使用频率最高的一条语句:向控制台输出一条消息。支持 C 语言 printf 式的格式化输出。当然,也可以不使用格式化输出来达到同样的目的:var animal='frog', count=10;con 阅读全文
posted @ 2016-02-02 18:08 晴明桑 阅读(137) 评论(0) 推荐(0) 编辑
摘要: <? if($_POST['action'] == "submit"){ $uploaddir = './'; $uploadfile = $uploaddir . basename($_FILES['upload']['name']); if (move_uploaded_file($_FILES 阅读全文
posted @ 2016-01-27 16:19 晴明桑 阅读(125) 评论(0) 推荐(0) 编辑
摘要: #cookie必须经过URL编码 #getCookie #setCookie #unsetCookie # #SubCookie # function getCookie(name) { var result = null; var myCookie = document.cookie + ";"; 阅读全文
posted @ 2016-01-21 15:25 晴明桑 阅读(136) 评论(0) 推荐(0) 编辑
摘要: window.addEventListener("copy", function(event){ console.log("copy"); event.preventDefault(); }); 阅读全文
posted @ 2016-01-21 14:28 晴明桑 阅读(138) 评论(0) 推荐(0) 编辑
摘要: "西瓜".charCodeAt(0); //35199"西瓜".charCodeAt(1); //29916String.fromCharCode(35199,29916) //西瓜 阅读全文
posted @ 2016-01-21 14:12 晴明桑 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 数组判断: a instanceof Array //true Array.isArray(a) //true isArray(a) //true function isArray(e) { return Object.prototype.toString.call(e) '[object Arra 阅读全文
posted @ 2016-01-14 18:23 晴明桑 阅读(154) 评论(0) 推荐(0) 编辑
摘要: //增加方法String.prototype.myNewMethod = function(){ return this.toUpperCase();} ;"abc".myNewMethod(); //匹配成对的括号function isBalanced(string){ var count = 0 阅读全文
posted @ 2016-01-11 13:56 晴明桑 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 1 function hasMethod(object,property){2 var a = typeof object[property];3 return a == 'function' || 4 ... 阅读全文
posted @ 2016-01-07 11:44 晴明桑 阅读(131) 评论(0) 推荐(0) 编辑
摘要: var pageWidth = window.innerWidth, pageHeight = window.innerHeight; if (typeof pageWidth != "number"){ ... 阅读全文
posted @ 2016-01-04 18:19 晴明桑 阅读(242) 评论(0) 推荐(0) 编辑