1、javascript是一种基于对象的语言,其中有四个常用的“全局对象”的成员使用,因为没有“全局对象关键字global”而直接使用,所以感觉像违背了JavaScript基于对象编程的原则,但其实是没有的。分别有encodeURL和decondeURL分别对字符和空格进行编码解码,encodeURLComponent和decodeURLComponent分别对所有普通字符进行编码。(一下代码帮助理解)
////直接调用而没有使用任何的“显示”对象,对比数学方法:Math.ceil()天花板
encodeURL and decodeURL //编码:不会对URL的特殊字符进行编码,对空格和汉字进行编码 var uri = "http://www.wrox.com/illegal value.htm#start大"; alert(encodeURI(uri)); //"http://www.wrox.com/illegal%20value.htm#start" document.write(encodeURI(uri)); //解码 alert(decodeURI("http://www.wrox.com/illegal%20value.htm#start%E5%A4%A7")); //对所有特殊字符编码 //编码 alert(encodeURIComponent(uri)); //"http%3A%2F%2Fwww.wrox.com%2Fillegal%20value.htm%23start" //解码 alert(encodeURIComponent(uri));
2、javascript中的对象字面量和动态属性
3、函数是一个变量和强类型语言中的函数不同,它可以在函数中嵌套函数又成为(闭包)