javascript 知识扩展

1:javascript类型:
6种:undefined null number string boolean function

首字母大写才是类型: Undefined Number Object Function Null***

第7种 object

2:typeof运算符

alert(typeof a ) // undefined

if(typeof a =="undefined"){} //true

typeof返回的是字符串不是类型 ,一定要记住,所以上面的if语句中的引号是不能不写的的。

3:命名法: 应该使用 匈牙利命名法命名变量 驼峰命名法命名函数

4:javascript this指针 prototype使用

 

  1. $(function(){
  2. alert("aaaaaaaaaaa");
  3. functionsayHi(){
  4. alert("hello");
  5. returnthis;
  6. }
  7. functionsayHi2(){
  8. alert("hello2");
  9. returnthis;
  10. }
  11. functionPerson(){
  12. }
  13. Person.prototype.sayHello=sayHi;
  14. Person.prototype.sayHello2=sayHi2;
  15. varmarry=newPerson();
  16. marry.sayHello().sayHello2();
  17. });

5:javascript 编码 解码

这是javascript的函数.
encodeURI("url地址")//编码
decodeURI("url地址")//解码

你可能感兴趣的:(JavaScript)