试听笔记:javascript入门精通

一、数据类型

1.原始类型:number、string、boolean、null、undefined

2.对象类型:Object (Function、Array、Date...)

P.类型隐式转换:'32'-2=30 //自动将字符串32转换为数字32

P.==和===:

    '1.23'==1.23,0==false,null==undefined,new Object()==new Object(),[1,2]==[1,2]

    null===null,undefined===undefined,NaN≠NaN,new Object()≠new Object()

P.包装类型(number、string、boolean):

    var str = 'string'; //'string'

    var strObj = new string('string'); //String{0:'s', 1:'t', 2:'r', 3:'i', 4:'n', 5:'g', length:6, [[PrimitiveValue]]:'string'}

    假如给str添加属性,str.t=10则成功,再次访问str.t则返回undefined,访问不到属性t,因为str临时对象访问完后即被销毁

P.类型检测:

    typeof、instanceof、Object.prototype.toString、constructor、duck type

    typeof 100 //'number'

    typeof true //'boolean'

    typeof function //'function'

    typeof undefined //'undefined'

    typeof new Object() //'object'

    typeof [1,2] //'object'

    typeof NaN //'number'

    typeof null //'object'

二、表达式和运算符

p.表达式

1.原始表达式

    常量、直接量  //3.14、'test'

    关键字  //null、this、true

    变量  //i、j、k

2.复合表达式

    通过运算符  //10*20

3.数组、对象的初始化表达式

    [1,2]  //new Array(1,2)

    [1,,,2]  //[1,undefined,undefined,2]

    {x:1,y:2}  // var o = new Object(); o.x=1,o.y=2

4.函数表达式

    var fe = function(){};

5.属性访问表达式

6.调用表达式

p.运算符

一元运算符 //+num

二元运算符 //a+b

三元运算符 //c?a:b

赋值//x+=1、比较//a==b、算术//a-b、位//a|b、逻辑//exp1&&exp2、字符串//'a'+'b'、特殊//delete obj.x

特殊运算符: 条件运算符、逗号运算符 //var val = (0,1,2) 值为2,取最右边的值、delete、in、instanceof、new、this、typeof、void

三、语句

四、对象

五、数组

六、函数

七、this

八、闭包和作用域

九、OOP

十、正则与模式匹配

posted @ 2016-08-09 10:27  sunbey80  阅读(136)  评论(0编辑  收藏  举报