2011年7月24日

javascipt的类型

摘要: js中的类型很让人纠结,没有一个标准,严格的判别方法,根据我对相关资料的理解,js类型可分为两大部分,一是基本类型,一是复合类型基本类型包括:undefined null number string boolean五种,但是null比较特殊,typeof null 得到的结果是'object'复合类型:只有一个object,但是object又可分为两类, 可执行的(function),不可执行的(object),如果按其内部属性[[class]]来分的话又可分为很多种类。关于typeof请参见另一篇文章typeof 操作符参考:ecma-262 edition5.1 ----- 阅读全文

posted @ 2011-07-24 15:10 argb 阅读(248) 评论(0) 推荐(0) 编辑

typeof 操作符

摘要: typeof操作符也是一元操作符其产生式(production)为:UnaryExpression:typeof UnaryExpression其求值过程如下:1、先对右侧的一元表达式求值,将结果赋给val2、 如果Type(val)是引用(Referecne),那么 a、如果IsUnresolvableReference(val) 是true ,返回"undefinded" b、把GetValue(val)的结果赋给val3、返回一个由Type(val)决定的字符串,相见下表基本规律为:如果是typeof的目标是基本类型(undefinded,number,string, 阅读全文

posted @ 2011-07-24 14:40 argb 阅读(324) 评论(0) 推荐(0) 编辑

void操作符

摘要: void操作符也许常常被用到,但是可能大家对其了解不多。void操作符是一个一元运算符,求值结果总是undefined,但是其求值过程可能会产生副作用:E.gvartemp=1;varb=void(temp=2);alert(temp)//result:2alert(b);//result:undefined参考:ecma 262 edition 5.1----11.4.2 The void Operator 阅读全文

posted @ 2011-07-24 14:17 argb 阅读(204) 评论(0) 推荐(0) 编辑

函数表达式

摘要: ecma 262 (5.1 Edition / June 2011)中关于函数的定义:SyntaxFunctionDeclaration :function Identifier ( FormalParameterListopt ) { FunctionBody }FunctionExpression :function Identifieropt( FormalParameterListopt) { FunctionBody }FormalParameterList :Identifier FormalParameterList , IdentifierFunctionBody :Sour. 阅读全文

posted @ 2011-07-24 13:45 argb 阅读(464) 评论(0) 推荐(0) 编辑

导航