摘要: //1、Boolean类型:是布尔值对应的引用类型//和布尔值有点区别,typeof()返回的是Objectconsole.log("Boolean类型");var falseObject = new Boolean(false);var falseValue = false;console.log(typeof(falseObject));//objectconsole.log(typeof(falseValue));//booleanconsole.log(falseObject instanceof Boolean);//trueconsole.log(falseVa 阅读全文
posted @ 2013-06-09 21:46 金帛 阅读(560) 评论(0) 推荐(0)
摘要: //length属性:表示函数希望接收的命名参数的个数//prototype属性:保存所有实例方法的地方,如toString()和valueOf()都保存在prototype下console.log("函数的属性length,prototype");function sayName(name) { alert(name);}function sum(num1, num2) { return num1 + num2;}function sayHi() { alert('hi');}console.log(sayName.length);//1console.l 阅读全文
posted @ 2013-06-09 19:47 金帛 阅读(361) 评论(0) 推荐(0)
摘要: getByClass: function (oParent, sClass) {//class选择器 var aChild = oParent.getElementsByTagName('*'); var result= []; var re = new RegExp('\\b' + sClass + '\\b', 'i'); for (var i=0; i<aChild.length; i++) { if (re.test(sClass)) { result.push(aChild[i... 阅读全文
posted @ 2013-06-09 17:23 金帛 阅读(135) 评论(0) 推荐(0)
摘要: function factorial(num) { if (num < 1) { return 1; } else { return num * arguments.callee(num - 1); //等价于 return num * factorial(num - 1); }}alert(factorial(5));//5*4*3*2*1 阅读全文
posted @ 2013-06-09 16:54 金帛 阅读(209) 评论(0) 推荐(0)