JavaScript
sells2012
这个作者很懒,什么都没留下…
展开
-
JavaScript排序
var a = [2,44,55,1 ]排序方法1:a.sort();//55,44,2,1排序方法2:用函数直接量a.sort(function(a,b){return a-b;});//1,2,44,55原创 2012-11-09 23:37:13 · 265 阅读 · 0 评论 -
javascript 各种数值代表的boolean值
3.3.1. Boolean Type ConversionsBoolean values are easily convertible to and from other types and are often automatically converted.[*] If a boolean value is used in a numeric context, true convert原创 2013-12-23 18:00:20 · 610 阅读 · 0 评论 -
js参数转换,各种类型参数在另一种类型里代表什么
3.12. Type Conversion SummaryAs each datatype has been described in the previous sections, I've discussed how values of each type convert into values of other types. The basic rule is that when a va原创 2013-12-24 10:13:15 · 572 阅读 · 0 评论 -
js值传递和引用传递
3.15. By Value Versus by ReferenceIn JavaScript, as in all programming languages, you can manipulate a data value in three important ways.[*] First, you can copy it. For example, you might assig原创 2013-12-24 11:28:07 · 1757 阅读 · 0 评论 -
js中的闭包
要理解闭包,首先必须理解Javascript特殊的变量作用域。变量的作用域无非就是两种:全局变量和局部变量。Javascript语言的特殊之处,就在于函数内部可以直接读取全局变量。Js代码 var n=999; function f1(){ alert(n); } f1(); // 999另一方面,在函数外部自然无法转载 2014-01-23 09:34:37 · 530 阅读 · 0 评论 -
js的换行符空格符\0 \b
\0The NUL character (\u0000).\bBackspace (\u0008).\tHorizontal tab (\u0009).\nNewline (\u000A).\vVertical tab (\u000B).\原创 2013-12-23 17:52:29 · 12450 阅读 · 0 评论 -
js中进制转换
3.2.4. Converting Numbers to StringsNumbers are automatically converted to strings when needed. If a number is used in a string concatenation expression, for example, the number is converted to a原创 2013-12-23 17:54:32 · 674 阅读 · 0 评论 -
常用的验证数字字母组合的正则表达式
验证数字的正则表达式集 验证数字:^[0-9]*$验证n位的数字:^\d{n}$验证至少n位数字:^\d{n,}$验证m-n位的数字:^\d{m,n}$验证零和非零开头的数字:^(0|[1-9][0-9]*)$验证有两位小数的正实数:^[0-9]+(.[0-9]{2})?$验证有1-3位小数的正实数:^[0-9]+(.[0-9]{1,3})?$验证非零的正整数:^\+?[1-9][转载 2014-02-26 10:41:25 · 14976 阅读 · 0 评论