Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Copyright By Free for non-commercial use. Editable provided that the copyright claim is included."— Presentation transcript:

1 Copyright By wangyoutian@nilnul.comwangyoutian@nilnul.com Free for non-commercial use. Editable provided that the copyright claim is included.

2 Notational Conventions For Heading Slides: Background  Hue: Red, Yellow, Green, Cyan, Blue, Magenta  as in Iris  Saturation decreases  Brightness increases Color offset to Background Font size  decreases Position  Shifted right Sideline slides are grey

3 Notational Conventions Unordered List Bullets Ordered by color and the bigness of colored area Font size decreases  

4 Built in objects

5 Category Native Objects Built In  String, Number, Array, Image, Date, Math User-Defined Objects. Host Objects window

6

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

8

9 NaN Infinity undefined

10 isNaN isFinite

11 parseInt parseFloat

12 URI decodeURI decodeURIComponent encodeURI encodeUTIComponent escape unescape

13 encodeURI('a//: 中文 ') "a//:%20%E4%B8%AD%E6%96%87" encodeURIComponent('a//: 中文 ') "a%2F%2F%3A%20%E4%B8%AD%E6%96%87"

14 Escape is used for strings encodeURI(‘a 中文 ') “a%20%E4%B8%AD% E6%96%87" escape("ab._ 中文 c") "ab._%20%u4E2D%u6 587c"

15 constructors Boolean Number String Object Function Array

16 constructors Date RegExp

17 error Error EvalError RangeError ReferenceError SyntaxError TypeError URIError

18 Math JSON

19 eval

20

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

22 Object alert(Object instanceof Object);//true alert(Object instanceof Function);//true alert(typeof Object); //function Object function (){[navti ve code]} Object.pr ototype Inherit{1}.prototype “Creat e”.constructor inherit Object Function.prototype.constructor

23 Object.prototype

24 Object.prototype.toString ( ) [object class]

25

26 Function’s Constructor Function function (){[navti ve code]} Object.pr ototype Inherit{1}.prototype “Create”.constructor inherit Function Function.prototype.a=1; alert(Function.a);

27 (A function)’s Constructor function f() { } alert(f.constructor); alert(f.constructror.constructor); alert(Function.constructor); alert(f.constructor.constructor.c onstructor); alert(f.constructor.constructor.c onstructor.constructor); Function funct ion1 function (){[navti ve code]} Object.pr ototype Inherit{1}.prototype Create.constructor inherit

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

29 Function.prototype

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

31 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.

32 Function Instances

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

34

35 String var a = String("a"); var b = new String("b"); alert(typeof a);//string alert(a);//a; alert(typeof b);//object alert(b);//b

36 Date Date() returns a string new Date() returns an object inspect( Date() ); inspect( new Date() );

37 Math [[Class]] Math

38 Array [[Class]]:Array

39 Date.prototype.toString This 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.

40 JSON contains two functions, parse and stringify, [[Class]] JSON Extensible [[Construct]] false [[Call]] false

41 Thank You!


Download ppt "Copyright By Free for non-commercial use. Editable provided that the copyright claim is included."

Similar presentations


Ads by Google