2015年12月13日

JS的作用域和作用域链

摘要: 一:函数作用域 先看一小段代码:var scope="global";function t(){ console.log(scope); var scope="local" console.log(scope);}t();第一句输出的是: "undefined",而不是 "glob... 阅读全文

posted @ 2015-12-13 12:46 wjw413c 阅读(254) 评论(0) 推荐(0) 编辑

JS给字符串排序

摘要: function quick_sort(arr) { var arry1, arry2, mid; if (arr.length arr[1]) return arr.r... 阅读全文

posted @ 2015-12-13 11:45 wjw413c 阅读(1094) 评论(0) 推荐(0) 编辑

JS中的Join

摘要: join() 方法用于把数组中的所有元素放入一个字符串。各元素是通过指定的分隔符进行分隔。使用join可以实现格式化数字到指定长度的字符串。这种方法快速,高效低资源消耗。function format_Number(i,len){var pre= new Array(len-String(i).le... 阅读全文

posted @ 2015-12-13 11:05 wjw413c 阅读(270) 评论(0) 推荐(0) 编辑

导航