copyright by wangyoutian@nilnul.comwangyoutian@nilnul.com free for non-commercial use. editable...

Post on 31-Dec-2015

212 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Copyright

By wangyoutian@nilnul.com

Free for non-commercial use.Editable provided that the copyright claim is

included.

Notational ConventionsFor Heading Slides:

Background Hue: Red, Yellow, Green, Cyan, Blue, Magenta

as in Iris Saturation decreases Brightness increases

Color offset to BackgroundFont size

decreasesPosition

Shifted rightSideline slides are grey

Notational Conventions

Unordered List BulletsOrdered by color and the bigness of colored areaFont size decreases

Built in objects

CategoryNative Objects

Built In String, Number, Array, Image, Date, Math

User-Defined Objects.

Host Objectswindow

global is read only and cannot be referenced.window is a member of global.window refers to global.

NaNInfinityundefined

isNaNisFinite

parseIntparseFloat

URI decodeURIdecodeURIComponentencodeURIencodeUTIComponent

escapeunescape

encodeURI('a//: 中文 ') "a//:%20%E4%B8%AD%E6%96%87"

encodeURIComponent('a//: 中文 ') "a%2F%2F%3A%20%E4%B8%AD

%E6%96%87"

Escape is used for strings

encodeURI(‘a 中文 ') “a%20%E4%B8%AD

%E6%96%87"

escape("ab._ 中 文c")

"ab._%20%u4E2D%u6587c"

constructorsBooleanNumberStringObjectFunctionArray

constructorsDateRegExp

errorErrorEvalErrorRangeErrorReferenceErrorSyntaxErrorTypeErrorURIError

MathJSON

eval

Object can be used as a [function]Thus a constructor.

Objectalert(Object

instanceof Object);//true

alert(Object instanceof Function); //true

alert(typeof Object);//function

Object

function()

{[navtive

code]}

Object.prototype

Inherit{1}

.prototype

“Create”

.constructor

inherit

Object

Function

.prototype

.constructor

Object.prototype

Object.prototype.toString ( ) [object class]

Function’s Constructor

Function

function()

{[navtive

code]}

Object.prototype

Inherit{1}

.prototype

“Create”

.constructor

inherit

Function

Function.prototype.a=1;alert(Function.a);

(A function)’s Constructorfunction f() { }alert(f.constructor);alert(f.constructror.construc

tor);alert(Function.constructor);alert(f.constructor.construct

or.constructor);alert(f.constructor.construct

or.constructor.constructor);

Function

function

1

function()

{[navtive

code]}

Object.prototype

Inherit{1}

.prototype

Create

.constructor

inherit

Function the [[Class]]Function is a sub[[Class]] of “Object”[[Class]]

Function.prototype

Function prototype object is itself a Function object (its [[Class]] is "Function") that, when invoked, accepts any arguments and returns undefined.

Unless specified otherwise, the [[Class]] internal property of a built-in object is "Function" if that built-in object has a [[Call]] internal property, or "Object" if that built-in object does not have a [[Call]] internal property.

Function Instances

functionfunction a() { }

a=function(){}function (){}new Function()

Function(…)

String

var a = String("a");var b = new String("b");

alert(typeof a);//stringalert(a);//a;alert(typeof b);//objectalert(b);//b

DateDate() returns a stringnew Date() returns an object

inspect(Date()

);inspect(

new Date());

Math[[Class]] Math

Array[[Class]]:Array

Date.prototype.toStringThis function returns a String value. The

contents of the String are implementation-dependent, but are intended to represent the Date in the current time zone in a convenient, human-readable form.

JSONcontains two functions, parse and stringify,[[Class]] JSONExtensible[[Construct]] false[[Call]] false

Thank You!

top related