You are on page 1of 256

Javascript.

ru

;)

ECMA-262, 3
03.2009
: http://javascript.ru/ecma


ECMA , JavaScript (Netscape) JScript (Microsoft). Brendan Eich Netscape
Navigator 2.
Netscape - Microsoft, Internet Explorer 3.0, -
.
1996. ECMA
ECMA 1997.
ECMA ISO/IEC JTC 1
ISO/IEC 16262 1998. 1998
ECMA ECMA-262, ISO/IEC
16262. - .

, , ,
try/catch, ,

.
.
,
,
W3C Wireless Application Protocol Forum.
3- ECMA-262 ECMA
1999 .
. . - ,
. javascript 1.5. Javascript 1.6
, 1.5 Mozilla.
, Internet Explorer, Opera
http://javascript.ru/ecma[14.03.09 12:52:12]

Google Chrome, ( ) .
2009
, javascript.ru.

ECMA.
1.
2.
3.
4.


4.1 Web
4.2
4.2.1
4.3
4.3.1
4.3.2
4.3.3
4.3.4
4.3.5
4.3.6
4.3.7
4.3.8
4.3.9
4.3.10
4.3.11
4.3.12 Null
4.3.13
4.3.14 Boolean
4.3.15 Boolean
4.3.16
4.3.17 String
4.3.18 String
4.3.19
4.3.20 Number
4.3.21 Number
4.3.22
4.3.23 NaN
5.
5.1
5.1.1 -
5.1.2
5.1.3
5.1.4
5.1.5
5.2
6.
7.
7.1
7.2
http://javascript.ru/ecma[14.03.09 12:52:12]

7.3
7.4
7.5
7.5.1
7.5.2
7.5.3 ,
7.6
7.7
7.8
7.8.1 Null
7.8.2
7.8.3
7.8.4
7.8.5
7.9
7.9.1
7.9.2
8.
8.1 Undefined
8.2 Null
8.3 Boolean
8.4 String
8.5 Number
8.6 Object
8.6.1
8.6.2
8.7 Reference
8.7.1 (V)
8.7.2 (V, W)
8.8 List
8.9 Completion
9.
9.1 ToPrimitive
9.2 ToBoolean
9.3 ToNumber
9.3.1 ToNumber String
9.4 ToInteger
9.5 ToInt32: ( 32- )
9.6 ToUint32: ( 32- )
9.7 ToUint16: ( 16- )
9.8 ToString
9.8.1 ToString Number
9.9 ToObject
10.
10.1
10.1.1 Function
10.1.2
10.1.3
10.1.4
10.1.5
10.1.6
http://javascript.ru/ecma[14.03.09 12:52:12]

10.1.7 This
10.1.8
10.2
10.2.1
10.2.2 Eval-
10.2.3
11.
11.1
11.1.1 this
11.1.2
11.1.3
11.1.4
11.1.5
11.1.6
11.2
11.2.1
11.2.2 new
11.2.3
11.2.4
11.2.5
11.3
11.3.1
11.3.2
11.4
11.4.1 delete
11.4.2 void
11.4.3 typeof
11.4.4
11.4.5
11.4.6 +
11.4.7 11.4.8 ( ~ )
11.4.9 ( ! )
11.5
11.5.1 *
11.5.2 /
11.5.3 %
11.6
11.6.1 ( + )
11.6.2 ( - )
11.6.3 ( +, - )
Number
11.7
11.7.1 ( << )
11.7.2 ( >> )
11.7.3 ( >>> )
11.8
11.8.1 - ( < )
11.8.2 - ( > )
11.8.3 ( <= )
11.8.4 -- ( >= )
http://javascript.ru/ecma[14.03.09 12:52:12]

12.

13.

14.
15.

11.8.5
11.8.6 instanceof
11.8.7 in
11.9
11.9.1 ( == )
11.9.2 - ( != )
11.9.3
11.9.4 ( === )
11.9.5 ( !== )
11.9.6
11.10
11.11
11.12 ( ?: )
11.13
11.13.1 ( = )
11.13.2 ( op= )
11.14 - ( , )

12.1
12.2
12.3
12.4 -
12.5 if
12.6
12.6.1 do-while
12.6.2 while
12.6.3 for
12.6.4 for-in
12.7 continue
12.8 break
12.9 return
12.10 with
12.11 switch
12.12
12.13 throw
12.14 try

13.1
13.1.1
13.1.2
13.2 Function
13.2.1 [[Call]]
13.2.2 [[Construct]]

ECMAScript
15.1
15.1.1 -
15.1.2 -
15.1.3 - URI
15.1.4 -
15.1.5

http://javascript.ru/ecma[14.03.09 12:52:12]

15.2 Object
15.2.1 Object
15.2.2 Object
15.2.3 Object
15.2.4 - Object
15.2.5 Object
15.3 Function
15.3.1 Function
15.3.2 Function
15.3.3 Function
15.3.4 - Function
15.3.5 Function
15.4 Array
15.4.1 Array
15.4.2 Array
15.4.3 Array
15.2.4 - Array
15.4.5 Array
15.5 String
15.5.1 String
15.5.2 String
15.5.3 String
15.5.4 - String
15.5.5 String
15.6 Boolean
15.6.1 Boolean
15.6.2 Boolean
15.6.3 Boolean
15.6.4 - Boolean
15.6.5 Boolean
15.7 Number
15.7.1 Number
15.7.2 Number
15.7.3 Number
15.7.4 - Number
15.7.5 Number
15.8 Math
15.8.1 - Math
15.8.2 - Math
15.9 Date
15.9.1 Date

15.9.2 Date
15.9.3 Date
15.9.4 Object
15.9.5 - Date
15.9.6 Date
15.10 RegExp ( )
15.10.1
15.10.2
15.10.3 RegExp
http://javascript.ru/ecma[14.03.09 12:52:12]

15.10.4 RegExp
15.10.5 RegExp
15.10.6 - RegExp
15.10.7 RegExp
15.11 Error
15.11.1 Error
15.11.2 Error
15.11.3 Error
15.11.4 - Error
15.11.5 Error
15.11.6 ,
15.11.7 NativeError
16.
A -
B -
: .


1.
ECMAScript.

C
2.
ECMAScript
, , , ,
, .

Unicode Standard, 2.1
, ISO/IEC 10646-1 UCS-2 UTF-16
, 3 . ISO/IEC 10646-1
, , BMP, 300.
, , UTF-16.

ECMAScript

, , , ,
. , ECMAScript
, ,
, .
ECMAScript
, .
, ECMAScript
, ", ",
http://javascript.ru/ecma[14.03.09 12:52:12]

.7.5.3 .

3.
ISO/IEC 9899: 1996 Programming Languages - C, including amendment 1 and technical
corrigenda 1 and 2.
ISO/IEC 10646-1: 1993 Information Technology --Universal Multiple-Octet Coded Character
Set (UCS) plus its amendments and corrigenda.
Unicode Inc. (1996), The Unicode Standard , Version 2.0. ISBN: 0-201-48345-9, AddisonWesley Publishing Co., Menlo Park, California.
Unicode Inc. (1998), Unicode Technical Report #8: The Unicode Standard , Version 2.1.
Unicode Inc. (1998), Unicode Technical Report #15: Unicode Normalization Forms.
ANSI/IEEE Std 754-1985: IEEE Standard for Binary Floating-Point Arithmetic. Institute of
Electrical and Electronic Engineers, New York (1985).


4.
ECMAScript.
ECMAScript - - ,

. ECMAScript , ,
.
.
, ECMAScript
, ,
,
,
, ,
, ,
ECMAScript.

- , ,
.
,

. ,
,
. ,

.
http://javascript.ru/ecma[14.03.09 12:52:12]

ECMAScript -
"" -
- .
ECMAScript ,
.
ECMAScript ,
, Java Self.
:
Gosling, James, Bill Joy and Guy Steele. The Java Language Specification. Addison
Wesley Publishing Co., 1996.
Ungar, David, and Smith, Randall B. Self: The Power of Simplicity. OOPSLA '87
Conference Proceedings, pp. 227-241, Orlando, FL, October 1987.
4.1
- ECMAScript
, , , , , ,
, , , , ,
, cookies -. ,
, ,
, , , , .
HTML,

. , ,
, .
- ,
, , ,
.

, -.
- , ECMAScript,
, ECMAScript.
4.2
ECMAScript -
. .
ECMAScript :
, ECMAScript
. ECMAScript ,
, ,
(, ReadOnly
true, ECMAScript
. ,
, . - ,
http://javascript.ru/ecma[14.03.09 12:52:12]

: Undefined, Null, Boolean, Number


String. - , Object;
, .
ECMAScript ,
ECMAScript. Global,
Object, Function, Array, String, Boolean, Number,
Math, Date, RegExp Error: Error, EvalError, RangeError,
ReferenceError, SyntaxError, TypeError URIError.
ECMAScript ,
, , . ECMAScript
, ,
, , , ,
, ,
-.
ECMAScript Java.
ECMAScript ,
. ,
,
.
4.2.1
ECMAScript , C++, Smalltalk
Java, ,
,
.
, .
Prototype,
.
new; , new String("A String")
String. new
, . , String("A String")
, .
ECMAScript .
, ,
( ),
. ,
( null) , ..;
. ,

, . ,
.
, .
, , .
- , ,
, .
ECMAScript , ,
http://javascript.ru/ecma[14.03.09 12:52:12]

.
, ,
, .
:

CF - ( ).
new : cf1, cf2, cf3, cf4 cf5.
q1 q2.
; , , cf3 CFp.
CF P1 P2,
CFp, cf1, cf2, cf3, cf4 cf5. CFP1 CFp cf1, cf2, cf3, cf4 cf5 (
CF), , CFp,
, q1, q2 CFP1. , CF CFp
.
, ,
. ,

.
cf1, cf2, cf3, cf4 cf5 CFp.
4.3
, ECMAScript.
4.3.1

- .
4.3.2

- Undefined, Null, Boolean, Number


String. - ,
http://javascript.ru/ecma[14.03.09 12:52:12]

.
4.3.3

- Object. ,
, . ,
, .
4.3.4

- Function, .
-,
.
4.3.5

- , ,
ECMAScript. ,
,
.
constructor.prototype, ,
, , , .
4.3.6

- , ECMAScript
. .
,
ECMAScript.
4.3.7

- , ECMAScript
,
ECMAScript. ECMAScript
, ECMAScript
. .
4.3.8

- ,
ECMAScript. , ,
.
4.3.9

(undefined) - , ,
.
4.3.10
Undefined , undefined.

http://javascript.ru/ecma[14.03.09 12:52:12]

4.3.11

(null) - ,
.
4.3.12 Null
Null , null.
4.3.13

- Boolean: true ()
false ().
4.3.14 Boolean
Boolean
. true, - false.
4.3.15 Boolean

Boolean - Object,
Boolean. Boolean Boolean
new , .
() ,
. Boolean .
4.3.16

- String,
16-
.

16- UTF-16,
, ,
16- .
4.3.17 String
String .
4.3.18 String

String Object String.


String String new ,
.
() , .
String
String (15.5.1).
4.3.19

- Number,
http://javascript.ru/ecma[14.03.09 12:52:12]

.
4.3.20 Number
Number - , . ECMAScript
64- IEEE
754, "-" (NaN),
.
4.3.21 Number

Number - Object,
Number. Number Number
new , .
() ,
. Number
Number (15.7.1).
4.3.22
Infinity
. Number.
4.3.23 NaN
NaN " " IEEE.
Number.


5.
5.1
- ,

ECMAScript.
5.1.1 -

- .
, ,

.
.
, ,
, -
, , (, )
,
,
.
http://javascript.ru/ecma[14.03.09 12:52:12]

5.1.2

ECMAScript 7.
. ,

,

.
, ,
ECMAScript ECMAScript.
, ,
ECMAScript. , , ,

(7.9).

. ( "/* --- */",
, )
, ;
,
,
.

- ECMAScript 15.10.
. ,
,
.
-
("::") .
-.
5.1.3
.
,
, .
9.3.1.

(":::") .
5.1.4

ECMAScript 11, 12, 13 14.


ECMAScript,
(5.1.2). ,
,
ECMAScript.
ECMAScript,

.
http://javascript.ru/ecma[14.03.09 12:52:12]

.
,

.

(":") . ,
0, 0, 0 0, ,

ECMAScript.

, , ,
" "
(

).

,
"" .
5.1.5


, ,
.
. , ,
ASCII-,
.
.
, . (
, .) ,
,
. , :

With :
with (

, With with ,
" ", " ", , ,
.
. :

,
,
, ,
. ,
.
, ,
.

.
http://javascript.ru/ecma[14.03.09 12:52:12]

"",
, () .
, ,
: . , :

:

:

:
for ( In

:
for (; ; )
for ( In ; ;

, , :

:
for (;; )
for (; ; )
for ( In ;; opt )
for ( In ; ; )
, , :

:
for (;;)
for (;; )
for (; ;)
for (; ; )
for ( In ;;)
for ( In ;; )
for ( In ; ;)
for ( In ; ; )
,
.
"[]" - ,
.

http://javascript.ru/ecma[14.03.09 12:52:12]

"[ ]" , ,
.
, .
. ,
,
. ,

::
0 1 2 3 4 5 6 7 8 9

::

::
n [ { 1, 3, 5, 7, 9}]
[ ]
n, ,
, ,
.
"[ ]"
, ,
, .. ,
. , :

Return :
return [ ]

, ,
return .

,
,
,
.
" " (-)
, ,
. ,
ECMAScript :

::
1 2 3 4 5 6 7 8 9

http://javascript.ru/ecma[14.03.09 12:52:12]

1
2
3
4
5
6
7
8
9

-
, ,
, .
,
. " ",
, . , :

::

,

, ,
, .
, ,
,
(Roman):

::

5.2
,
. .
,


.
,
" x" , x
. ( n)
" n". ( x) " x".
, , , , ,
,

,
, .
,

,

http://javascript.ru/ecma[14.03.09 12:52:12]

.
,
, .
, +0 -0,
0.
abs( x) x, -x, x
( ), x .
sign(x) 1 x -1
x. sign , x
.
"x modulo y " ( y )
k , y ( ), , abs( k )< abs( y ) x-k = q * y
q .
floor(x) (
), x.

floor(x) = x-(x modulo 1) .


" ",
, .
,
,
, " ...".
,
.


6.
ECMAScript
2.1
UTF-16. C
( ), 15
(UAX-15). ECMAScript
,
.

::
Unicode
ECMAScript .
, , ,
, ,
.
, ,
http://javascript.ru/ecma[14.03.09 12:52:12]

.
" " ""
16- ,
UTF-16.
" "
,
( 16- , ,
).
, .
" ",
.
,
( ) escape, : \u

escape .
escape .
escape-
.

1
"" "
" 16- , UTF-16
, , .. " "
16- .
2
ECMAScript Java
escape-. Java, , escape \u000A ,
( 000A - " "), ,
, .
, escape- \u000A
Java, ,
( Java,
, \u000A \n). ECMAScript

escape-


, , . ,
escape-
ECMAScript
,
.


7.

http://javascript.ru/ecma[14.03.09 12:52:12]

ECMAScript
: , ,
. ,

.

.
,
(/) -- (/=).

.
, ,
, ;

, (/)
. ,
.

::

::

7.1
(, "Cf"
, LEFT-TO-RIGHT MARK RIGHT-TO-LEFT MARK)
,
( ),
.
.

ECMAScript.
.
,
escape- (. 7.6) .
7.2

http://javascript.ru/ecma[14.03.09 12:52:12]


( ).
. ,
(
), -
.
:

\u0009
\u000B
\u000C
\u0020
\u00A0


"Zs"


" "

<TAB>
<VT>
<FF>
<SP>
<NBSP>
<USP>

::
<TAB>
<VT>
<FF>
<SP>
<NBSP>
<USP>
7.3
,
( ).
,
. ,
, ,
. - ,
.
(7.9).
:

\u000A
\u000D
\u2028
\u2029


<LF>

<CR>
<LS>
<PS>

http://javascript.ru/ecma[14.03.09 12:52:12]

::
<LF>
<CR>
<LS>
<PS>
7.4

: .
.
,
, , ,

// . ,
,

. ,
,
(7.9).
.
,
.
.

::

::
/*

*/

::

*
::

*
::

::
/
::
http://javascript.ru/ecma[14.03.09 12:52:12]

//

::

::

7.5

::

7.5.1

::

Null

7.5.2

ECMAScript.

ECMAScript

::

break else new var case finally return void catch for switch while continue function
this with default if throw delete in try do instanceof typeof

7.5.3 ,

, , ,
.

:: one of
http://javascript.ru/ecma[14.03.09 12:52:12]

abstract enum int short boolean export interface static byte extends long super char
final native synchronized class float package throws const goto private transient
debugger implements protected volatile double import public

7.6

, 5.16
3.0, .
,
. ,
2.1
ECMAScript.
ECMAScript ,
.
:
($) (_)
.
.
escape-

Escape (. 7.8.4). ( \),
Escape,
. Escape
. , \
Escape , ,
, .
, ,


( ,
ECMAScript ).
, C
, .

::

::

::

$
_
\

Escape

http://javascript.ru/ecma[14.03.09 12:52:12]

::

\ Escape

: " (Lu)", "


(Ll)", " (Lt)", "- (Lm)", " (Lo)", or
"- (Nl)".

: "- (Mn)"
" (Mc)"

" (Nd)"

" (Pc)"
Escape
7.8.4.
::

0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F

7.7

::
{
}
(
)
[
]
.
;
,
<
>
<=
>=
==
!=
===
!==
+

http://javascript.ru/ecma[14.03.09 12:52:12]

*
%
++
-<<
>>
>>>
&
|
^
!
~
&&
||
?
:
=
+=
-=
*=
%=
<<=
>>=
>>>=
&=
|=
^=

::
/
/=

7.8

::
Null

7.8.1 Null

Null ::
null

http://javascript.ru/ecma[14.03.09 12:52:12]

null- null Null, null.


7.8.2

::
true
false

true Boolean, true.


false Boolean, false.
7.8.3

::

::
.
.

::
0


::


::
0 1 2 3 4 5 6 7 8 9

::
1 2 3 4 5 6 7 8 9

::

::
e E

::

+
-
http://javascript.ru/ecma[14.03.09 12:52:12]

::
0x
0X

, ,
.

,
3in

, : 3 in.

.
: (),
, .
:: .
::
.
:: .
.
:: .
( ,
10 -n ), n .
:: .
, 10 e , e
.
:: .
( (
, 10 -n )) 10 e , n
e .
::. ,
10 -n , n .
:: .
of , 10 e-n , n
e .
::
.
::
, 10 e , e
.
:: 0 0.
:: (
10 n ) of , n
.
http://javascript.ru/ecma[14.03.09 12:52:12]

:: .
:: (
10) .
::
.
:: .
:: + .
:: -
.
:: 0 :: 0 0.
:: 1 :: 1 ::
1 1. :: 2 :: 2
:: 2 2.
:: 3 :: 3 ::
3 3.
:: 4 :: 4 ::
4 4.
:: 5 :: 5 ::
5 5. :: 6 :: 6
:: 6 6.
:: 7 :: 7 ::
7 7.
:: 8 :: 8 ::
8 8.
:: 9 :: 9 ::
9 9. :: a :: A
10.
:: b :: B 11.
:: c :: C 12.
:: d :: D 13.
:: e :: E 14.
:: f :: F 15.
:: 0x
of .
:: 0X
of .
::
( of
16) .
,
Number. 0, +0. ,
(
8.5), ,
20 .
,
0,
, 0
.
,

http://javascript.ru/ecma[14.03.09 12:52:12]

0,
,
.
7.8.4
,
. escape.

::
" "
'

'

::

::

::
-
\ Escape

"

- \

SingleStringCharacter ::
-

\ Escape

'

- \

Escape ::
Escape
0 [ ]
Escape
Escape
Escape ::
Escape
Escape
Escape ::
' " \ b f n r t v

Escape ::
Escape
Escape ::
Escape

x
u

http://javascript.ru/ecma[14.03.09 12:52:12]

Escape ::
x
Escape ::
u


2 6.

7.8.3.

String. ()
() .

() 7.8.3.
:: "" .
:: '' .
:: " "
.
:: " "
.
::
, .
::
,
.
::
, .
::

,
.
:: - "
- \ .
:: \ Escape
Escape. ::
- ' - \
.
:: \ Escape
Escape.
Escape :: Escape
Escape .
Escape :: 0 [ ]
<NUL> ( 0000).
Escape :: Escape
Escape .
Escape :: Escape
Escape.
Escape :: Escape
, Escape
:
http://javascript.ru/ecma[14.03.09 12:52:12]

Escape-
\b

\u0008

\t

\u0009

\n

\u000A

\v

\u000B

\f

\u000C

\r

\u000D

\"

\u0022

\'

\u0027

\\

\u005C



( )





<BS>
<HT>
<LF>
<VT>
<FF>
<CR>
"
'
\

Escape :: Escape
Escape.
Escape :: Escape
.
Escape :: x
, (16
) .
Escape :: u

, (4096 (.. 16 3 )
) (256 (.. 16 2 )
) (16
) .

'' ,
\.
escape-, \n
\u000A.
7.8.5
- ,
RegExp ( 15.10). ,
.
; .

, === ( )
, . RegExp
new RegExp
( 15.10.4) RegExp ( 15.10.3).


. ,

, , .
http://javascript.ru/ecma[14.03.09 12:52:12]

,
,
, - ,
.

::
/

::

::
[]

::
* \ /

::
\ /

::
\
::

::
[]

;
, //
. ,
/(?:)/.

Object.
: ,

, , ,
. new RegExp ,
. new RegExp
,
,
,
.
http://javascript.ru/ecma[14.03.09 12:52:12]

7.9
ECMAScript ( , ,
-, do-while , continue , break ,
return, throw ) .
. ,
,
. , ,
.
7.9.1

( -),
,
-, :
1. -
.
2. - }.

,
,
.
,
, [
] ,
.
, ,

,
.
:
,

for ( 12.6.3).

:
:
[ ]
[ ]

++
--

Continue :
continue [ ]
Break :
break [ ]
http://javascript.ru/ecma[14.03.09 12:52:12]

Return :
return [ ]
Throw :
throw [ ]

:
++ -- ,
,
++ --,
++ --.
continue, break, return throw
,
continue, break, return throw .
ECMAScript :
++ -- ,
.
return throw ,
return throw .
break continue ,
break continue .
7.9.2

{ 1 2 } 3

ECMAScript,
. ,
{1
2 } 3

ECMAScript,
:
{ 1
;2 ;} 3;

ECMAScript.

for (a; b
)

http://javascript.ru/ecma[14.03.09 12:52:12]

ECMAScript

,
for .
for .

return
a + b

:
return;
a + b;

a + b ,
return, "" return.

a = b
++c

:
a = b;
++c;

++ ,
"" b ++.

b,


if (a > b)
else c = d

ECMAScript
else , ,
,
.

a = b + c
(d + e).print()

,
, ,
:
a = b +c(d + e).print()

, ,
http://javascript.ru/ecma[14.03.09 12:52:12]


,
.

8.
- , .
(Undefined, Null, Boolean, String, Number, Object, Reference, List
Completion). Reference, List Completion

.
8.1 Undefined
Undefined (" ") - undefined.
, ,
undefined.
8.2 Null
Null ("", "") - null.
8.3 Boolean
Boolean ("", "") ,
: true false.
8.4 String
String ("")
16-
(""). String
ECMAScript.
(. 6).
.
. ( )
0, ( ) 1, ..
(. . 16- ), .
, , , .
,
UTF-16. , UTF-16
, String ,
UTF-16. String (
) ,

16-

http://javascript.ru/ecma[14.03.09 12:52:12]


String
. ,
, (
, ..)
C ,
. ,
(, ,
). ,
ECMAScript C,
(
), escape- .
8.5 Number
Number ("") 18 437 736 874 454 810 627 (.., 2 64 -2 53 +3)
, 64-
IEEE 754 IEEE
, , 9007199254740990 (.., 2 53 -2)
"-" IEEE ECMAScript
NaN. (, NaN
NaN , NaN
.) "" , .
ECMAScript NaN .
,
.
+ - . (,
+Infinity ( Infinity) Infinity, Infinity
.)
18 437 736 874 454 810 624 (.. 2 64 -2 53 )
. , .

, .
, , .
+0 -0
. (,
+0 ( 0) -0.)
18 437 736 874 454 810 622 (.., 2 64 -2 53 -2)
:
18 428 729 675 200 069 632 (.., 2 64 -2 54 )

s * m * 2e
s +1 or -1, m - , 2 53 , 2 52
http://javascript.ru/ecma[14.03.09 12:52:12]

e - -1074 971 .
9 007 199 254 740 990 (.. 2 53 -2) :

s * m * 2e
s +1 or -1, m - , 2 52 e -1074.
, ,
2 53 , Number ( 0 : +0 -0).
, m,
( ) . .
" x", x
(
, ), ,
. Number,
-0 ,
Number: 2 1024 (.. +1 * 2 53 * 2 971) -2 1024 (.. -1 * 2 53 * 2 971 ).
, x.
, ,
2 1024 -2 1024 .
, 2 1024, +; -2 1024,
-; +0, -0
, x ; .
x. (
" " IEEE 754.)
ECMAScript
-2 31 2 31 -1 0 2 32 -1 .

Number,

32
2
.
. ToInt32 ToUint32 0 0 .
8.6 Object
Object ("") .
, .
8.6.1
:

ReadOnly

.
ECMAScript . ( ,
ReadOnly
,
. " " "

http://javascript.ru/ecma[14.03.09 12:52:12]

"!)
DontEnum for-in ( 12.6.4).
. .
DontDelete
delete 11.4.1.
-
.
Internal
.
.
8.6.2
.
. ECMAScript
,
.
[[ ]].
, ,
TypeError.
( ) : get put,
.
ECMAScript [[Prototype]].
null , .
. [[Prototype]]
get, put.
,
.
ECMAScript.
. ,
, .

[[Prototype]]
[[Class]]

.
, .
,
[[Value]]

.
[[Get]]
() .
(,
[[Put]]
.
)
, ,
[[CanPut]]
() [[Put]]
.
, ,
[[HasProperty]] ()
.
[[Delete]]
() .
,
[[DefaultValue]] ()
(
).
http://javascript.ru/ecma[14.03.09 12:52:12]

[[Construct]]

[[Call]]

[[HasInstance]] ()
[[Scope]]

[[Match]]

(,
)

. new .
, ,
.
, .
. ,
,
.
, ,
Value .
ECMAScript Function
[[HasInstance]].
, ,
Function.

MatchResult (. 15.10.2.1).

( )
[[Prototype]] [[Class]] [[Get]], [[Put]], [[CanPut]], [[HasProperty]], [[Delete]]
[[DefaultValue]]. ( , [[DefaultValue]]
TypeError.)
[[Prototype]] ("") , null,
[[Prototype]] (..
, [[Prototype]]
null).
[[Prototype]]
.
[[Class]]
. [[Class]]
[[Class]] .
[[Class]]
. ,

,

Object.prototype.toString (. 15.2.4.2).
[[Get]], [[Put]], [[CanPut]], [[HasProperty]], [[Delete]]
[[DefaultValue]] 8.6.2.1, 8.6.2.2, 8.6.2.3,
8.6.2.4, 8.6.2.5 8.6.2.6 , , Array
[[Put]] (. 15.4.5.1).
, .
, , [[Get]] [[Put]]
,
[[HasProperty]] false.
, O -
ECMAScript, P - .
8.6.2.1 [[Get]](P)
http://javascript.ru/ecma[14.03.09 12:52:12]

[[Get]] O P,
:
1. O P - 4.
2. .
3. (2).
4. [[Prototype]] O null - undefined.
5. [[Get]] [[Prototype]], P.
6. (5).
8.6.2.2 [[Put]](P, V)
[[Get]] O P V ,
:
1. [[CanPut]] O , P.
2. (1) false - .
3. O P - 6.
4. V . .
5. .
6. P, V
.
7. .
, , O - Array, [[Put]]
(15.4.5.1).
8.6.2.3 [[CanPut]](P)
[[CanPut]] [[Put]].
[[CanPut]] O P,
:
1. O P - 4.
2. ReadOnly - false.
3. true.
4. [[Prototype]] O null - true.
5. [[CanPut]] [[Prototype]] O , P.
http://javascript.ru/ecma[14.03.09 12:52:12]

6. (5).
8.6.2.4 [[HasProperty]](P)
[[HasProperty]] O P,
:
1. O P - true.
2. [[Prototype]] O null - false.
3. [[HasProperty]] [[Prototype]], P.
4. (3).
8.6.2.5 [[Delete]](P)
[[Delete]] O P,
:
1. O P - true.
2. DontDelete - false.
3. P O .
4. true.
8.6.2.6 [[DefaultValue]]()
[[DefaultValue]]
:

String,

1. [[Get]] O , "toString".
2. (1) - 5.
3. [[Call]] (1), O this
.
4. (3) - (3).
5. [[Get]] O , "valueOf".
6. (5) - 9.
7. [[Call]] (5), O this
.
8. (7) - (7).
9. TypeError.
[[DefaultValue]] O
:
http://javascript.ru/ecma[14.03.09 12:52:12]

Number,

1. [[Get]] O , "valueOf" .
2. (1) - 5.
3. [[Call]] (1), O this
.
4. (3) - (3).
5. [[Get]] O , "toString" .
6. (5) - 9.
7. [[Call]] (5), O this
.
8. (7) - (7).
9. TypeError.
[[DefaultValue]] O , ,
Number, , O Date (. 15.9), ,
String.
[[DefaultValue]]
.
[[DefaultValue]], , [[DefaultValue]]
.
8.7 Reference

Reference ("") .
.
ECMAScript ,
. Reference

.
Reference delete,
typeof .
. ,

, :
.
. ECMAScript,
, ,

.
(


,
, .)
Reference this
http://javascript.ru/ecma[14.03.09 12:52:12]

.
Reference . Reference
, .

:
(V). V.
(V). V.

:

8.7.1 (V)
1. ( V ) Reference - V .
2. ( V ).
3. (2) null - ReferenceError.
4. [[Get]] (2), ( V )
.
5. (4).
8.7.2 (V, W)
1. ( V ) Reference - ReferenceError.
2. ( V ).
3. (2) null - 6.
4. [[Put]] (2), ( V )
W .
5. .
6. [[Put]] , ( V )
W .
7. .
8.8 List

List ("") .
. ECMAScript
, List
. List

.

http://javascript.ru/ecma[14.03.09 12:52:12]

List (. 11.2.4),
new . List
.
.
8.9 Completion

Completion ("") .
.
ECMAScript ,
Completion .
Completion
.
Completion ( break, continue,
return throw)
. Completion (, ,
), - normal, break, continue, return throw, -
ECMAScript , - ECMAScript .
" " ,
normal.


9.
ECMAScript
. ,
. .
. ,
, Reference, List
Completion (.. ).
9.1 ToPrimitive
ToPrimitive (" ")
. ToPrimitive , Object.
,
, .
:

Undefined
Null

(
).
(
).
(

http://javascript.ru/ecma[14.03.09 12:52:12]

Boolean
Number
String

Object
9.2 ToBoolean

).
(
).
(
).
.

[[DefaultValue]]
. [[DefaultValue]]
ECMAScript (8.6.2.6).

ToBoolean (" ") Boolean


:

Undefined false
Null
false
(
Boolean
).
false, +0, -0 NaN,
Number
true.
false, (
String
), true.
Object
true
9.3 ToNumber
ToNumber (" ") Number
:

Undefined NaN
Null
+0
1, true. +0,
Boolean
false.
(
Number
).
String
. .
:
Object

1. ToPrimitive( , Number).
2. ToNumber((1)).
3. (2).

http://javascript.ru/ecma[14.03.09 12:52:12]

9.3.1 ToNumber String


ToNumber ,
.
, ToNumber NaN.

:::


:::

:::
<TAB>
<SP>
<NBSP>
<FF>
<VT>
<CR>
<LF>
<LS>
<PS>
<USP>
:::

:::

+
-
:::
Infinity

.
.

:::


:::
0 1 2 3 4 5 6 7 8 9

:::

:::
http://javascript.ru/ecma[14.03.09 12:52:12]

e E

:::

+
-
:::
0x
0X

:::

0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F

(. 7.8.3):

/
.

0.
+ -,
.

+0.

(. 7.8.3),
,
Number . :
() ,
:
::: [] 0.
::: 0.
:::
,
.
:::
.
:::
.
:::
.
::: +
.
::: -
, . (,
0,
0.
+0 -0
http://javascript.ru/ecma[14.03.09 12:52:12]

.)
::: Infinity ("")
10 10000 (.. , + ).
::: .
. ::: .
(
, 10 -n ), n -
.
::: .
10 e , e
.
::: .
(
, 10 -n )), 10 e , n -
e .
::: .
10 -n , n
.
::: .
10 e-n , n
, e .
:::
.
:::
10 e , e
.
::: .
::: (
10) .
:::
.
::: .
::: + .
::: -
.
::: 0 ::: 0 0.
::: 1 ::: 1 1.
::: 2 ::: 2 2.
::: 3 ::: 3 3.
::: 4 ::: 4 4.
::: 5 ::: 5 5.
::: 6 ::: 6 6.
::: 7 ::: 7 7.
::: 8 ::: 8 8.
::: 9 ::: 9 9.
::: a ::: A 10.
::: b ::: B 11.
::: c ::: C 12.
::: d ::: D 13.
::: e ::: E 14.
http://javascript.ru/ecma[14.03.09 12:52:12]

::: f ::: F 15.


::: 0x
.
::: 0X
.
:::
(
16)
.
,
Number. 0,
+0. ,
'-', -0.

( 8.5), ,
20
. ,
0,
,
0


0,
,
.
9.4 ToInteger
ToInteger (" ") .
:
1. ToNumber .
2. (1) NaN - +0.
3. (1) +0, -0, + - - (1).
4. sign((1)) * floor(abs((1))).
5. (4).
9.5 ToInt32: ( 32- )
ToInt32 2 32
-2 31 2 31 -1 . :
1. ToNumber .
2. (1) NaN, +0, -0, + - - +0.
3. sign((1)) * floor(abs((1))).
http://javascript.ru/ecma[14.03.09 12:52:12]

4. (3) modulo 2 32 , .. k
Number 2 32 ,
(3) k 2 32 .
5. (4) 2 31 - (4)-2 32 ,
(4).

ToInt32:
ToInt32 :
, .

ToInt32(ToUint32(x)) ToInt32(x) x. (
+ - +0.)
ToInt32 -0 +0.
9.6 ToUint32: ( 32- )
ToInt32 2 32
0 2 32 -1 . :
1. ToNumber .
2. (1) NaN, +0, -0, + - - +0.
3. sign((1)) * floor(abs((1))).
4. (3) modulo 2 32 , .. k
Number 2 32 ,
(3) k 2 32 .
5. (4).

ToUInt32:
5 ToUint32 ToInt32.
ToUint32 :
, .

ToUint32(ToInt32(x)) ToUint32(x) x. (
+ - +0.)
ToUint32 -0 +0.
9.7 ToUint16: ( 16- )
ToUint16 2 16
16

http://javascript.ru/ecma[14.03.09 12:52:12]

0 2

-1 . :

1. ToNumber .
2. (1) NaN, +0, -0, + - - +0.
3. sign((1)) * floor(abs((1))).
4. (3) modulo 2 16 , .. k
Number 2 16 ,
(3) k 2 16 .
5. (4).

ToUint16:
2 32 2 16 4 ToUint32
ToUint16.
ToUint16 -0 +0.
9.8 ToString
ToString (" ") String
:

Undefined
Null

"undefined"
"null"

true, "true".
false, "false".
Number
. .
String
( )
:
1. ToPrimitive( , String).
Object
2. ToString((1)).
3. (2).
9.8.1 ToString Number
Boolean

ToString m :
1. m NaN - "NaN".
2. m +0 -0 - "0".
3. m - "-" ToString( -m).
4. m - "Infinity".
5. , n, k s - , k >= 1, 10 k-1 <= s <10k,
http://javascript.ru/ecma[14.03.09 12:52:12]

s * 1 0n -k m k .
, k s , s
10 s
.
6. k <= n <= 21 - , k
s ( , ), n k
'0'.
7. 0 < n <= 21 - , n
s , '. ' k - n
s .
8. -6 <n <= 0 - , '0',
'. ', -n '0' k s .
9. , k = 1 - s ,
'e', '+' '-' ( , n-1
), abs( n-1) (
).
10. , s,
'. ', k-1
s, 'e', '+'
'-' ( , n-1 ),
abs(n-1) ( ).

,
:
x - , -0, ToNumber(ToString(x))
x.
s 5.
, ,
, 5:
, n, k s - , k >= 1, 10 k-1 <= s <10k,
s * 10 n-k m k .
s - , s
* 10 n-k m. s . , k
s s 10 .
ECMAScript .
:
Gay, David M. Correctly Rounded Binary-Decimal and Decimal-Binary Conversions.
Numerical Analysis Manuscript 90-10. AT&T Bell Laboratories (Murray Hill, New Jersey).
November 30, 1990. http://cm.bell-labs.com/cm/cs/doc/90/4-10.ps.gz.
http://javascript.ru/ecma[14.03.09 12:52:12]

http://cm.belllabs.com/netlib/fp/dtoa.c.gz http://cm.bell-labs.com/netlib/fp/g_fmt.c.gz ,
- netlib.
9.9 ToObject
ToObject (" ") Object
:

Undefined TypeError.
Null
TypeError.
Boolean [[value]]
Boolean
. Boolean . 15.6.
Number [[value]]
Number
. Number . 15.7.
String [[value]]
String
. String . 15.7.
(
Object
).


10
ECMAScript,
. .

.
10.1
10.1.1 Function
Function:


Function .
, parseInt
Math.exp.
, .
, ECMAScript,
.
10.1.2
ECMAScript:

http://javascript.ru/ecma[14.03.09 12:52:12]

- ,
ECMAScript.
, .
Eval- - , eval . ,
eval ,
ECMAScript. Eval- eval
, .
- , .

, .
, Function ,
. , ,
Function ,
. Function ,

.
,
.
Function ,
.
10.1.3 ()
.
, ,
.
.

- ,
.
:
: ,
, ,
.
[[Call]].
,
, undefined.
, ,
,
, .
,
undefined.
,
,
,
Function, 13, .
,
.
.
http://javascript.ru/ecma[14.03.09 12:52:12]

In
, ,
In,
undefined .
,
.

. ,
,
.
10.1.4

. - ,
.
,
, .

with (. 12.10) catch (. 12.14).

: :
1. . ,
5.
2. [[HasProperty]] (1),
.
3. (2) true, Reference,
(1), - .
4. 1.
5. Reference, null ,
- .

Reference, .

10.1.5
(. 15.1),
, - .
:
, Math, String, Date, parseInt ..
{ DontEnum }.
, .
, . ,
HTML window
.
http://javascript.ru/ecma[14.03.09 12:52:12]

,
ECMAScript .
10.1.6
, ,
, .
arguments { DontDelete }.
.

.
,
. ECMAScript
. ,
. Reference,
, this
null .
10.1.7 This

this. this
, . this,
, .
10.1.8
,
, :
[[Prototype]]
- Object, .. ,
Object.prototype (. 15.2.3.1).
callee { DontEnum }.
- Function,
. .
length { DontEnum }.
,
.
arg , length
ToString( arg ) { DontEnum }.
,
. arg = 0,
- arg = 1 . , arg
Function,
. ,

.
10.2
http://javascript.ru/ecma[14.03.09 12:52:12]

,
. (return)
. , ,
.
,
,
this.
,
this , .

10.2.1
,
.

, { DontDelete }.
this .
10.2.2 Eval-
eval-,
, this
, .
, ,
this ,
.

, .
,
with catch .

.
this this .
10.2.3
,
,
[[Scope]] Function.

{ DontDelete }.
this . this,
, (, null - ),
this .

http://javascript.ru/ecma[14.03.09 12:52:12]

11
11.1

:
this

( )
11.1.1 this
this this .
11.1.2
,
10.1.4.
Reference.
11.1.3
7.8.
11.1.4
,
Array, .
,
. .
, .
, .
,
(. .
), Array

:
[ ]
[ ]
[ ,

:

,
http://javascript.ru/ecma[14.03.09 12:52:12]

:
,
,

: [ ]
:
1. , new Array().
2. ( ,
).
3. [[Put]] (1) "length" (2).
4. (1).
: [ ]
:
1. .
2. (1).
: [ , ]
:
1. .
2. ( ,
).
3. [[Get]] (1) "length".
4.
(3)).

[[Put]] (1) "length" ((2) +

5. (1).

1. , new Array().
2. ( ,
).
3. .
4. ((3)).
5. [[Put]] (1) (2) (4).
http://javascript.ru/ecma[14.03.09 12:52:12]

6. (1)

1. .
2. ( ,
).
3. .
4. ((3)).
5. [[Get]] (1) "length".
6. [[Put]] (1) ((2)+ (5))
(4).
7. (1)
: , :
1. 1.
: , :
1. .
2. ((1)+ 1).
11.1.5
,
Object, .

. -
, .

{}
{ }

:
:
, :
:

http://javascript.ru/ecma[14.03.09 12:52:12]


: {} :
1. , new Object().
2. (1).
: { }
:
1. .
2. (1).

1. , new Object().
2. .
3. .
4. ((3)).
5. [[Put]] (1) (2) (4).
6. (1).
: ,
: :
1. .
2. .
3. .
4. ((3)).
5. [[Put]] (1) (2) (4).
6. (1).
: :
1. , ,
.
2. (1).
:
:
http://javascript.ru/ecma[14.03.09 12:52:12]

1. .
:
:
1. .
2. ToString((1)).
11.1.6
: ( )
:
1. . Reference.
2. (1).

(1).

delete typeof .
11.2

[ ]
.
new
New :

new New
Call :

Call
Call [ ]
Call .
:

()
( )

,
:
http://javascript.ru/ecma[14.03.09 12:52:12]

New
Call
11.2.1

:

.
Call .
:

[
Call [ ]

<->

Call

Call [ <-> ]

<->

,
, .

:

1. .
2. ((1)).
3. .
4. ((3)).
5. ToObject((2)).
6. ToString((4)).
7. Reference, (5),
- (6).
Call : Call [ ]
, 1
Call.
http://javascript.ru/ecma[14.03.09 12:52:12]

11.2.2 new
New : new New
:
1. New.
2. ((1)).
3. ((2)) Object, TypeError.
4. (2) [[Construct]],
TypeError.
5. [[Construct]] (2), (..
).
6. (5).

:

new

1. .
2. ((1)).
3. , (.
11.2.4).
4. ((2)) Object, TypeError.
5. (2) [[Construct]],
TypeError.
6. [[Construct]] (2), Result(3)
.
7. (6).
11.2.3
Call :
:
1. .
2. , (.
11.2.4).
3. ((1)).
4. ((3)) Object - TypeError.
5. (3) [[Call]] -
http://javascript.ru/ecma[14.03.09 12:52:12]

TypeError.
6. ((1)) - Reference, (6) ((1)).
(6) null.
7. (6) , (7) null.
(7) (6).
8. [[Call]] (3), Result(7) this
Result(2) .
9. (8).
Call : Call
, 1
Call.

(8) Reference, (3)


ECMAScript. Reference -
.
11.2.4

(. 8.8).
: () :
1. .
: ( )
:
1. .
2. (1).
:
:
1. .
2. ((1)).
3. , - (2).
: ,
:
1. .
2. .

http://javascript.ru/ecma[14.03.09 12:52:12]

3. ((2)).
4. , , (1),

(1), (3)
.
11.2.5

:

1. .
2. (1).
11.3

[ ]
[ ]

++
--

11.3.1
: [
] ++ :
1. .
2. ((1)).
3. ToNumber((2)).
4. 1 (3) , +
(. 11.6.3).
5. ((1), (4)).
6. (3).
11.3.2
: [
] -- :
1. .
2. ((1)).
3. ToNumber((2)).

http://javascript.ru/ecma[14.03.09 12:52:12]

4. 1 (3) , (. 11.6.3).
5. ((1), (4)).
6. (3).
11.4

delete
void
typeof
++
--
+
-
~
!
11.4.1 delete
: delete
:
1. .
2. ((1)) Reference - true.
3. ((1)).
4. ((1)).
5. [[Delete]] (3), (4)
, .
6. (5).
11.4.2 void
: void
:
1. .
2. ((1)).
3. undefined.
11.4.3 typeof

http://javascript.ru/ecma[14.03.09 12:52:12]

: typeof
:
1. .
2. ((1)) Reference - 4.
3. ((1)) null - "undefined".
4. ((1)).
5. , ((4)) :

Undefined
"undefined"
Null
"object"
Boolean
"boolean"
Number
"number"
String
"string"
Object ( [[Call]]) "object"
Object ( [[Call]])
"function"
Object ( )

11.4.4
: ++
:
1. .
2. ((1)).
3. ToNumber((2)).
4. 1 (3) , +
(. 11.6.3).
5. ((1), (4)).
6. (4).
11.4.5
: --
:
1. .
2. ((1)).
3. ToNumber((2)).
4. 1 (3), , http://javascript.ru/ecma[14.03.09 12:52:12]

(. 11.6.3).
5. ((1), (4)).
6. (4).
11.4.6 +
+ Number.
: +
:

1. .
2. ((1)).
3. ToNumber((2)).
4. (3).
11.4.7 - Number
. , +0 -0, -0
+0.
: :

1. .
2. ((1)).
3. ToNumber((2)).
4. (3) NaN - NaN.
5. (3), .. ,
.
6. (5).
11.4.8 ( ~ )
: ~
:

1. .
2. ((1)).
3. ToInt32((2)).
4. (3). 32http://javascript.ru/ecma[14.03.09 12:52:12]

.
5. (4).
11.4.9 ( ! )
: !
:

1. .
2. ((1)).
3. ToBoolean((2)).
4. (3) true - false.
5. true.
11.5

*
/
%

: @
, @
, :
1. .
2. ((1)).
3. .
4. ((3)).
5. ToNumber((2)).
6. ToNumber((4)).
7. (*, /, %) (5) (6). .
( 11.5.1, 11.5.2, 11.5.3).
8. (7).
11.5.1 *

http://javascript.ru/ecma[14.03.09 12:52:12]

* , .
. ECMAScript
.

IEEE 754:
NaN, NaN.
, , ,
.
NaN.
.
.

. .
, ,
NaN,
IEEE "--".
,
.
, .
ECMAScript " "
IEEE 754.
11.5.2 /
/ , .
, - . ECMAScript
.
.
IEEE 754:
NaN, NaN.
, , ,
.
NaN.
.
.

. .
.
.
NaN,
, .
.
.
, ,
, NaN,
IEEE "--".
,
.
, (
http://javascript.ru/ecma[14.03.09 12:52:12]

) . ECMAScript
" " IEEE 754.
11.5.3 %
% .
, - .

C C++ .
ECMAScript .

% "", IEEE 754.
"" IEEE 754 , ,
, ,
. ECMAScript %
,
Java. fmod
C.
ECMAScript
IEEE:
NaN, NaN.
.
/ ,
NaN.
, - .
, - .
, ,
, NaN, r n d
r = n (d *q), q
, , n/d ,
n/ d , ,
n d.
11.6

+
-
11.6.1 ( + )
, .

:
1. .
http://javascript.ru/ecma[14.03.09 12:52:12]

2. ((1)).
3. .
4. ((3)).
5. ToPrimitive((2)).
6. ToPrimitive((4)).
7. ((5)) String ((6)) String -
12. (, 3
, .)
8. ToNumber((5)).
9. ToNumber((6)).
10. (8) (9). .
( 11.6.3).
11. (10).
12. ToString((5)).
13. ToString((6)).
14. (12) (13).
15. (14).

ToPrimitive 5 6 -.
ECMAScript Date ,
Number. Date
, String.
- .
11.6.2 ( - )

:
1. .
2. ((1)).
3. .
4. ((3)).
5. ToNumber((2)).
6. ToNumber((4)).
http://javascript.ru/ecma[14.03.09 12:52:12]

7. (5) (6). .
( 11.6.3).
8. (7).
11.6.3 ( +,- ) Number
+, ,
. -
.
- , .

IEEE 754:
NaN, NaN.
NaN.
.

.
-0.
+0.
.
+0.
, ,
, NaN , ,

IEEE "--".
,
. ECMAScript
" " IEEE 754.
+ ,
. , . a b a- b a+(- b)
.
11.7

<<
>>
>>>
11.7.1 ( << )
,
, .
http://javascript.ru/ecma[14.03.09 12:52:12]

: <<
:
1. .
2. ((1)).
3. .
4. ((3)).
5. ToInt32((2)).
6. ToUint32((4)).
7. (6) 5 , .. (6) & 0x1F.
8. (5) (7) . 32-
.
9. (8).
11.7.2 ( >> )

, , .
: >>
:
1. .
2. ((1)).
3. .
4. ((3)).
5. ToInt32((2)).
6. ToUint32((4)).
7. (6) 5 , .. (6) & 0x1F.
8. (5) (7) .
"" . 32 .
9. (8).
11.7.3 ( >> )

, , .
http://javascript.ru/ecma[14.03.09 12:52:12]

: >>>
:
1. .
2. ((1)).
3. .
4. ((3)).
5. ToUint32((2)).
6. ToUint32((4)).
7. (6) 5 , .. (6) & 0x1F.
8. (5) (7) . ""
. 32-
.
9. (8).
11.8

<
>
<=
>=
instanceof
in

In :

In
In
In
In
In

<
>
<=
>=
instanceof

'In'
in for .

in

Boolean
,

http://javascript.ru/ecma[14.03.09 12:52:12]

In ,
,
In .
11.8.1 - ( < )
: <
:
1. .
2. ((1)).
3. .
4. ((3)).
5. (2) < (4) (. 11.8.5).
6. (5) undefined - false. (5).
11.8.2 - ( > )
: >
:
1. .
2. ((1)).
3. .
4. ((3)).
5. (4) < (2) (. 11.8.5).
6. (5) undefined - false. (5).
11.8.3 ( <= )

1. .
2. ((1)).
3. .
4. ((3)).
5. (4) < (2) (. 11.8.5).
6. (5) true undefined - false. true.
http://javascript.ru/ecma[14.03.09 12:52:12]

<=

11.8.4 -- ( >= )

>=

1. .
2. ((1)).
3. .
4. ((3)).
5. (2) < (4) (. 11.8.5).
6. (5) true undefined - false. true.
11.8.5
x < y , x y , true, false undefined
( , NaN).
:
1. ToPrimitive( x, Number).
2. ToPrimitive( y , Number).
3. ((1)) String ((2)) String -
16. (, 7 +
, .)
4. ToNumber((1)).
5. ToNumber((2)).
6. (4) NaN - undefined.
7. (5) NaN - undefined.
8. (4) (5) false.
9. (4) +0 (5) -0 - false.
10. (4) -0 (5) +0 - false.
11. (4) +, false.
12. (5) +, true.
13. (5) -, false.
14. (4) -, true.
15. (4) ,
http://javascript.ru/ecma[14.03.09 12:52:12]

(5) (, ) true. false.


16. (2) (1), false. (
p q , q
p r. ,
, .. r .)
17. (1) (2), true.
18. k - , k
(1) k (2). ( k
, .. ,
.)
19. m - , k
(1).
20. n - , k (2).
21. m < n, true. false.

.
,
, .
, ,
, ECMAScript. ,
, .
11.8.6 instanceof

instanceof

1. .
2. ((1)).
3. .
4. ((3)).
5. (4) , TypeError.
6. (4) [[HasInstance]],
TypeError.
7. [[HasInstance]] (4) (2).
8. (7).
11.8.7 in
http://javascript.ru/ecma[14.03.09 12:52:12]

in

1. .
2. ((1)).
3. .
4. ((3)).
5. (4) , TypeError.
6. ToString((2)).
7. [[HasProperty]] (4) (6).
8. (7).
11.9

==
!=
===
!==
In :
In
In == In
In != In
In === In
In !== In

Boolean
,
.
In ,
,
In In
.
11.9.1 ( == )

:
http://javascript.ru/ecma[14.03.09 12:52:12]

==

1. .
2. ((1)).
3. .
4. ((3)).
5. (4) == (2) (. 11.9.3).
6. (5).
11.9.2 - ( != )

!=

1. .
2. ((1)).
3. .
4. ((3)).
5. (4) == (2) (. 11.9.3).
6. (5) true - false. true.
11.9.3
x == y , x y , true false.
:
1. ( x) ( y ) - 14.
2. ( x) Undefined - true.
3. ( x) Null - true.
4. ( x) Number - 11.
5. x NaN - false.
6. y NaN - false.
7. x , y , - true.
8. x +0, y -0, true.
9. 8. x -0, y +0, true.
10. false.
11. ( x) String - true, x y
http://javascript.ru/ecma[14.03.09 12:52:12]

(
). false.
12. ( x) Boolean, true, x y true
false. false.
13. true, x y
, (. 13.1.2). false.
14. x null, y undefined - true.
15. x undefined, y null - true.
16. ( x) Number, ( y ) String, x ==
ToNumber( y ).
17. ( x) String, ( y ) Number,
ToNumber( x)== y .
18. ( x) Boolean, ToNumber( x)== y .
19. ( y ) Boolean, x == ToNumber( y ).
20. ( x) - String Number, ( y ) - Object, x ==
ToPrimitive( y ).
21. ( x) - Object, ( y ) - String Number,
ToPrimitive( x)== y .
22. false.

:
:

""+a ==""+ b.

a -0 ==b -0.

!a == !b.

:
A != B

!(A == B).

A == B

B == A

B.

. ,
String, ;
String
==, String .

. ,

http://javascript.ru/ecma[14.03.09 12:52:12]

, 2.0. ,
, ,
ECMAScript. , ,
.
11.9.4 ( === )

===

1. .
2. ((1)).
3. .
4. ((3)).
5. (4) === (2) (. .)
6. (5).
11.9.5 ( !== )

!==

1. .
2. ((1)).
3. .
4. ((3)).
5. (4) === (2) (. .)
6. (5) true - false. true.
11.9.6
x === y , x y , true false.
:
1. ( x) ( y ), false.
2. ( x) Undefined - true.
3. ( x) Null - true.
4. ( x) Number - 11.
5. x NaN - false.
6. y NaN - false.
http://javascript.ru/ecma[14.03.09 12:52:12]

7. x , y , - true.
8. x +0, y -0 - true.
9. x -0, y +0 - true.
10. false.
11. ( x) String - true, x y
(
). false.
12. ( x) Boolean, true, x y true
false. false.
13. true, x y
, (. 13.1.2). false.
11.10

&

In :
In
In

&

In

In :
In
In

In

|
In :
In
In | In

A : A @B, @ -
, :
1. A .
http://javascript.ru/ecma[14.03.09 12:52:12]

2. ((1)).
3. B .
4. ((3)).
5. ToInt32((2)).
6. ToInt32((4)).
7. @ (5) (6).
32- .
8. (7).
11.11

&&
In :
In
In && In
:

||

In :
In
In

||

In

:
1. .
2. ((1)).
3. ToBoolean((2)).
4. (3) false - (2).
5. .
6. ((5)).
7. (6).

http://javascript.ru/ecma[14.03.09 12:52:12]

&&

:
:

||

1. .
2. ((1)).
3. ToBoolean((2)).
4. (3) true - (2).
5. .
6. ((5)).
7. (6).
In In
,


In,
In

In


, .

, && ||, Boolean.


- .
11.12 ( ?: )

In :
In
In ? :
In

: :
1. .
2. ((1)).
3. ToBoolean((2)).
4. (3) false - 8.

http://javascript.ru/ecma[14.03.09 12:52:12]

5. .
6. ((5)).
7. (6).
8. .
9. ((8)).
10. (9).
In ,
,
In,
,

In

ECMAScript
C Java, , ,
.
ECMAScript,
,
.
11.13


In :
In
In
:

= *= /= %= += -= <<= >>= >>>= &= ^= |=

In ,
,
In In
.
11.13.1 ( = )

:
http://javascript.ru/ecma[14.03.09 12:52:12]

1. .
2. .
3. ((2)).
4. ((1), (3)).
5. (3).
11.13.2 ( = )
: @ =
, @ ,
:
1. .
2. ((1)).
3. .
4. ((3)).
5. @ (2) (4).
6. ((1), (5)).
7. (5).
11.14 - ( , )

,
In :
In
In , In

: ,
:
1. .
2. ((1)).
3. .
4. ((3)).
http://javascript.ru/ecma[14.03.09 12:52:12]

5. (4).
In ,
, In
In
.

12

If

Continue
Break
Return
With

Switch
Throw
Try

,
, .
" ".

.
Switch .
.
12.1

http://javascript.ru/ecma[14.03.09 12:52:12]

: {} :
1. (normal, empty, empty).
: { } :
1. .
2. (1).
:
:
1. .
2. , (throw, V , empty), V - . (
, .)
3. (1).
:
:
1. .
2. (1) , (1).
3. .
4. , (throw, V , empty), V - . (
, .)
5. (3). empty, V = (1). ,
V = (3). .
6. ((3). , V , (3). ).
12.2

:
var
:

In :
In
In
:
http://javascript.ru/ecma[14.03.09 12:52:12]

In


In :
In
:
=
In :
= In

,

10.1.3.
(..
10.1.3) { DontDelete }. ,
. .
.
undefined. ,

,
.

: var ;
:
1. .
2. (normal, empty, empty).

1. .
: ,
:
1. .
2. .

:

1. , ,
.

http://javascript.ru/ecma[14.03.09 12:52:12]

:
1. 11.1.2.
2. .
3. ((2)).
4. ((1), (3)).
5. , ,
.
: =
:
1. .
2. (1).

In,

In In ,
,

, In,
In, In In

,
, .
12.3

:
;

: ; :
1. (normal, empty, empty).
12.4 -

:
[ { {,

function }]

, ,
.. .
function , ..
.

http://javascript.ru/ecma[14.03.09 12:52:12]

: [
:

{{, function}] ;

1. .
2. ((1)).
3. (normal, (2), empty).
12.5 if

If :
if (
if (

)
)

else

else , if
, if,
else.

If : if ( ) else
:
1. .
2. ((1)).
3. ToBoolean((2)).
4. (3) false - 7.
5. .
6. (5).
.
8. (7).
If : if ( )
:
1. .
2. ((1)).
3. ToBoolean((2)).
4. (3) false - (normal, empty, empty).
5. .
http://javascript.ru/ecma[14.03.09 12:52:12]

6. (5).
12.6
(
) (
).

:
do while ( );
while ( )
for ( In ; ; )
for (var In; ;

for ( in )
for (var In in )

12.6.1 do-while
do while ( );
:
1. V = empty.
2. .
3. (2). empty, V = (2). .
4. (2). continue (2).
- 7.
5. (2). break (2).
- (normal, V , empty).
6. (2) , (2).
7. .
8. ((7)).
9. ToBoolean((8)).
10. (9) true - 2.
11. (normal, V , empty);
12.6.2 while

:

http://javascript.ru/ecma[14.03.09 12:52:12]

while

1. V = empty.
2. .
3. ((2)).
4. ToBoolean((3)).
4. (4) false - (normal, V , empty).
6. .
7. (6). empty, V = (6). .
8. (6). continue (6).
- 2.
9. (6). break (6).
- (normal, V , empty).
10. 2. (6) , (6).
11. 2.
12.6.3 for
: for ( In ; ;
) :
1. In - 4.
2. In .
3. ((2)). ( .)
4. V = empty.
5. - 10.
6. .
7. ((6)).
8. ToBoolean((7)).
9. (8) false - 19.
10. .
11. (10). empty, V = (10).
.
12. (10). break (10).
- 19.
http://javascript.ru/ecma[14.03.09 12:52:12]

13. (10). continue (10).


- 15.
14. (10) , (10).
15. - 5.
16. .
17. ((16)).
.)

18. 5.
19. (normal, V , empty).

:
for
(var

In ; ; )
:
1. In.
2. V = empty.
3. - 8.
4. .
5. ((4)).
6. ToBoolean((5)).
7. (6) false - 17.
8. .
9. (8). empty, V = (8). .
10. (8). break (8).
- 17.
11. (8). continue (8).
- 13.
12. (8) , (8).
13. - 3.
14. .
15. ((14)).
.)
16. 3.
http://javascript.ru/ecma[14.03.09 12:52:12]

17. (normal, V, empty).


12.6.4 for-in
: for (
) :

in

1. .
2. ((1)).
3. ToObject((2)).
4. V = empty.
5. (3),
DontEnum. - 14.
6. (
).
7. ((6), (5)).
8. .
9. (8). empty, V = (8). .
10. (8). break (8).
- 14.
11. (8). continue (8).
- 5.
12. (8) , (8).
13. 5.
14. (normal, V , empty).
: for (var In in
) :
1. In .
2. .
3. ((2)).
4. ToObject((3)).
5. V = empty.
6. (4),
DontEnum. - 15.
http://javascript.ru/ecma[14.03.09 12:52:12]

7. (1) , . 0 (,
).
8. ((7), (6)).
9. .
10. (9). empty, V = (9). .
11. (9). break (9).
- 15.
12. (9). continue (9).
- 6.
13. (8) , (8).
14. 6.
15. (normal, V, empty).
() ( 5 , 6 )
. .
. ,
, , .
,
.
,
. , ""
- ,
.
12.7 continue

Continue :
continue [ ]

,
:
continue ,
( )
.
continue ,
, (
) continue .
Continue :
http://javascript.ru/ecma[14.03.09 12:52:12]

1. (continue, empty, empty).


Continue
:

1. (continue, empty, ).
12.8 break

Break :
break [ ]

,
:
break ,
( )
Switch.
continue ,
, (
) break .
Break :
1. (break, empty, empty).
Break :
1. (break, empty, ).
12.9 return

Return :
return [ ]

, return
. return
. ,
undefined. .
Return : return [ ]
; :
1. - (return, undefined, empty).
http://javascript.ru/ecma[14.03.09 12:52:12]

2. .
3. ((2)).
4. (return, (3), empty).
12.10 with

With :
with (

with
,
.

With : with ( )
:
1. .
2. ((1)).
3. ToObject((2)).
4. (3) .
5.
4.

6. C = (5). 5 , C =
(throw, V , empty), V - . ( ,
.)
7. (3) .
8. C .

'': ,
-
.
12.11 switch

Switch :
switch (

http://javascript.ru/ecma[14.03.09 12:52:12]

Case

Case :
{ Case }
{ Case Case

Case :
Case
Case Case
Case :
case

:
default :

Switch : switch ( ) Case


:
1. .
2. ((1)).
3. Case , (2) .
4. (3). break (2).
- (normal, (3)., empty).
5. (3).
Case : { Case } input
:
1. V = empty.
2. A Case .
3. C Case A . Case -
16.
4. C .
5. input (4) ( !== ) -
3.
6. C - 10.
7. C R .
8. R - , R .
9. V = R ..
10. C - Case A . Case -
16.
11. C - 10.
12. C , R .
13. R . empty, V = R ..
14. R - , ( R ., V , R .).
15. 10.
http://javascript.ru/ecma[14.03.09 12:52:12]

16. (normal, V , empty).


Case : { Case Case }
input :

1. V = empty.
2. A - Case Case
.
3. C - Case A . Case -
11.
4. C .
5. input (4) ( !== ) -
3.
6. C - 20.
7. C , R .
8. R - , R .
9. V = R ..
10. 20.
11. B - Case Case
.
12. C - Case B . Case -
26.
13. C .
14. input (13) ( !== ) -
12.
15. C - 31.
16. C , R .
17. R - , R .
18. V = R ..
19. 31.
20. C - Case A . Case -
26.
21. C - 20.
22. C , R .
23. R . , V = R ..
24. R - , ( R ., V , R .).
25. 20.
26. - 30.
27. , R .
28. R . , V = R ..
29. R - , ( R ., V , R .).
30. B Case Case
.
31. C - Case B . Case -
37.
32. C - 31.
33. C , R .
34. R . , V = R ..
35. R - , ( R ., V , R .).
36. 31.
37. (normal, V , empty).
http://javascript.ru/ecma[14.03.09 12:52:12]

Case : case :
:
1. .
2. ((1)).
3. (2).

Case
. ,
Case ,
.
12.12

:
:

.
break continue ,
. ECMAScript goto .
ECMAScript ,
,
. ,
, .
:
.
,
.
(break, V, L ), L ,
(normal, V , empty).
,
, ,
Switch .
, .
12.13 throw

Throw :
throw [ ] ;

http://javascript.ru/ecma[14.03.09 12:52:12]

Throw : throw [ ] ;
:
1. .
2. ((1)).
3. (throw, (2), empty).
12.14 try

Try :
try Catch
try Finally
try Catch Finally
Catch :

catch ( )

Finally :

finally

try ,
,
throw . catch . catch
, .

Try : try Catch :


1. .
2. (1). throw - (1).
3. Catch (1).
4. (3).
Try : try Finally :
1. .
2. Finally.
3. (2). normal, (1).
4. (2).

http://javascript.ru/ecma[14.03.09 12:52:12]

Try : try Catch Finally


:
1. .
2. C = (1).
3. (1). throw - 6.
4. Catch (1).
5. C = (4).
6. Finally.
7. (6). normal - C.
8. (6).
Catch : catch ( )
:
1. C , .
2. , new Object() .
3. (2). ,
C. , { DontDelete }.
4. (2) .
5. .
6. (2) .
7. (5).
Finally : finally :
1. .
2. (1).


13

:
function
:
http://javascript.ru/ecma[14.03.09 12:52:12]

){

function

){

:
function

){ }
:
1. Function 13.2,
.
.
2. (
10.1.3) (1).
: function (
){ } :
1. Function 13.2,
.
.
2. (1).

:
function

){ }

1. , new Object() .
2. (1) .
3. Function 13.2,
.
.
4. (1). ,
(3), - { DontDelete, ReadOnly }.
5. (1) .
6. (3).

,
, .
http://javascript.ru/ecma[14.03.09 12:52:12]


, ,
.

:

1. .
2. .
3. (2).
13.1
:
13.1.1

:

ECMAScript.

10.1.2.

, eval (15.1.2.1).
eval-
10.1.2.

, Function
(. 15.3.1 15.3.2), . ,
FunctionBody, eval ,
, eval
.
13.1.2
Function ,
:
, -
O ,
, O .
, - O ,
, O .
O P , == ===
.
, O P
P Q , O Q
.
http://javascript.ru/ecma[14.03.09 12:52:12]


, ,
.
,
- [[Scope]] .

. ,
Function.
, ,
[[Scope]] Function
,
Function .
,
ECMAScript.
13.2 Function

, , ,
, , Function
:
1. E,
, ,
, , - 13. (
E, -
.)
2. ECMAScript, F.
3. [[Class]] F "Function".
4. [[Prototype]] F Function
15.3.3.1.
5. [[Call]] F 13.2.1.
6. [[Construct]] F 13.2.2.
7. [[Scope]] F
( 10.1.4), , .
8. length F ,
. ,
length F 0.
15.3.5.1.
9. , new Object().
10. constructor (9) F.
{ DontEnum }.
http://javascript.ru/ecma[14.03.09 12:52:12]

11. prototype F (9).


15.3.5.2.
12. F.
13. 2, 14.
14. ECMAScript, E, F.
- E F, E F .
15. [[Class]] F "Function".
16. [[Prototype]] F Function
15.3.3.1.
17. [[Call]] F 13.2.1.
18. [[Construct]] F 13.2.2.
19. [[Scope]] F
( 10.1.4), , .
20. F.

prototype
.
1 A,
B.
B,
A. 13 ; ,
, 2 .
,
function A() {
function B(x) {return x* x;}
return B;
}
function C() {
return eval("(function(x) {return x* x;})");
}
var b1 =
var b2 =
function
function
var b5 =
var b6 =

A();
A();
b3(x) {return x* x;}
b4(x) {return x* x;}
C();
C();

, , b1 b2. ,
b1 b2 ,
[[Scope]]. , b3 b4,
( 13.1.1).
b5 b6, eval ,
http://javascript.ru/ecma[14.03.09 12:52:12]

, .
Function
, ,
[[Scope]] ,
. ,
.
13.2.1 [[Call]]
[[Call]] F Function,
:
1. ,
F, this
10.2.3.
2. .
3. , 1,
.
4. (2). throw - (2). .
5. (2). return - (2). .
6. ((2). normal.) undefined.
13.2.2 [[Construct]]
[[Construct]] F Function,
:
1. ECMAScript.
2. [[Class]] (1) "Object".
3. prototype F.
4. (3) , [[Prototype]] (1)
(3).
5. (3) , [[Prototype]] (1)
Object 15.2.3.1.
6. [[Call]] F, (1) this
, [[Construct]],
.
7. ((6)) Object - (6).
8. (1).

http://javascript.ru/ecma[14.03.09 12:52:12]


14.

:
:
1. .
2. .
3. (2).
:
:
1. .
:
:
1. .
2. (1).


:
1. .
2. .

:
1. .
http://javascript.ru/ecma[14.03.09 12:52:12]

2. (1) , (1).
3. .
4. (3).

.

:
:
1. .
2. (1).
:
:
1. (. 13).
:
:
1. (normal, empty, empty).

ECMAScript
15 ECMAScript
ECMAScript ,
. , ,
.
.
, [[Class]]
"Function" , [[Call]], "Object" ,
[[Call]].
, ..
. , ..
, new .

Function.
-
, new , .
,
, , ,
, , ()
,
undefined value.
http://javascript.ru/ecma[14.03.09 12:52:12]

,
, , ,
, . ,
( )
TypeError.

,
, ,
.
[[Prototype]]
" Function",
Function.prototype (. 15.3.2.1).
[[Prototype]] - Object,
Object.prototype (. 15.3.2.1).
,
, ,
[[Construct]] . ,
, , prototype .
Function, (
, , ),
length . ,
(
), , .

, Function, slice

String,


"String.prototype.slice(start , end)", start
end. length Function 2.
length Function,
, { ReadOnly, DontDelete, DontEnum }
. { DontEnum }
, .
15.1
[[Construct]].
new .
[[Call]].
.
[[Prototype]] [[Class]]
.
15.1.1 -
http://javascript.ru/ecma[14.03.09 12:52:12]

15.1.1.1 NaN
NaN NaN (. 8.5).
{ DontEnum, DontDelete}.
15.1.1.2 Infinity
Infinity + (. 8.5).
{ DontEnum, DontDelete}.
15.1.1.3 undefined
undefined undefined (. 8.1).
{ DontEnum, DontDelete}.
15.1.2 -
15.1.2.1 eval(x)
eval x,
:
1. x , x.
2. x . ,
SyntaxError ( . 16).
3. 2.
4. (3). normal V -
V .
5. (3). normal empty -
undefined.
6. (3). throw. (3). .
eval (..
Call ),
- , eval - EvalError.
15.1.2.2 parseInt(string , radix)
parseInt ,
string
radix. .
radix undefined 0, 10, ,
0x 0X, . (radix)
16. 16
0x 0X.
parseInt , :
1. ToString( string ).
http://javascript.ru/ecma[14.03.09 12:52:12]

2. S (1), ,
, . ( ,
.)
3. sign 1.
4. S S -, sign
-1.
5. S S + -,
S.
6. R = ToInt32( radix).
7. R =0 - 11.
8. R <2 R > 36 - NaN.
9. R = 16 - 13.
10. 14.
11. R = 10.
12. S 1, S "0",
R = 8 R .
13. S 2, S "0x" "0X" -
S R = 16.
14. S ,
R , Z S,
, Z S.
15. Z , NaN.
16. , Z
R , A-Z a-z
10 35. ( R 10, Z 20 ,
( ) 20- 0.
R 2, 4, 8, 10, 16 32, (16)
, Z
R .)
17. (16).
18. sign * (17).

parseInt
; , ,
, .
http://javascript.ru/ecma[14.03.09 12:52:12]

radix 0 undefined, ,
0, x X,
, . ,
.
15.1.2.3 parseFloat(string)
parseFloat ,
string .
parseFloat , :
1. ToString( string ).
2. (1), ,
. ( ,
.)
3. (2), (2)
(. 0), NaN.
4. (2) (
(2)), .
5. (4).

parseInt
; , ,
, .
15.1.2.4 isNaN(number)
ToNumber true,
NaN, false .
15.1.2.5 isFinite(number)
ToNumber false,
NaN, + -, true .
15.1.3 - URI
(URI) ,
(, - )
(, HTTP FTP) . ECMAScript
URI,
, URI 15.1.3.1,
15.1.3.2, 15.1.3.3 15.1.3.4.

ECMAScript
-.
http://javascript.ru/ecma[14.03.09 12:52:12]

.
URI , .
:

, ":", "/", ";" "?"


-. encodeURI decodeURI
URI. ,
URI
. encodeURI decodeURI
URI. ,
, URI
.
URI. uri :::
uri

Uri :::
Uri Uri
Uri :::
uri
uri
uri
uri :::
; / ? : @ & = + $ ,

uri :::
uri

uri
uri :::
%
uri :::

a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

uri :::

- _ . ! ~ * ' ( )

, URI,
,
, .
(8-
) UTF-8,
UCS-2 UCS-4. (,
[0,127] .)
http://javascript.ru/ecma[14.03.09 12:52:12]

,
escape- "% xx" ("").
Encode,
: string unescapedSet.
.
1. string .
2. R .
3. k 0.
4. k (1), R .
5. C - string , k .
6. C unescapedSet - 9.
7. S - , C .
8. 24.
9. C 0xDC00 0xDFFF ,
URIError.
10. C 0xDB00 0xDBFF ,
V C 16.
11. k 1.
12. k (1), URIError.
13. string , k .
14. (13) 0xDC00 0xDFFF ,
URIError.
15. V ((( C ) - 0xD800) * 0x400 + ((13) - 0xDC00) + 0x10000).
16. Octets ,
UTF-8 V , L .
17. j 0.
18. Octets j .
19. S , "% XY" , XY -
, (18).
20. R - ,
R S.
21. j 1.
http://javascript.ru/ecma[14.03.09 12:52:12]

22. j L - 25.
23. 18.
24. R - ,
R S.
25. k 1.
26. 4.
Decode,
: string reservedSet.
.
1. string .
2. R .
3. k 0.
4. k (1), R .
5. C - string , k .
6. C '% ', 40.
7. start k .
8. k + 2 (1), URIError.
9. string (k + 1) (k + 2)
, URIError.
10. B 8- ,
( k + 1) ( k + 2).
11. k 2.
12. B 0, C , B
37.
13. n - , (B << n) & 0x80 0.
14. n 1 n 4 - URIError.
15. Octets - 8- n.
16. B Octets 0.
17. k +(3 *(n - 1)) (1), URIError.
18. j 1.

http://javascript.ru/ecma[14.03.09 12:52:12]

19. j n - 29.
20. k 1.
21. k '%' - URIError.
22. string (k + 1) (k + 2)
, URIError.
23. B 8- ,
( k + 1) ( k + 2).
24. B 10, URIError.
25. k 2.
26. B Octets j.
27. j 1.
28. 19.
29. V , UTF-8
Octets (.. 32- ).
30. V 0x10000 - 36.
31. V 0x10FFFF - URIError.
32. L (((V - 0x10000) & 0x3FF) + 0xDC00).
33. H ((((V - 0x10000) >> 10) & 0x3FF) + 0xD800).
34. S - , H L.
35. 41.
36. C V .
37. C reservedSet - 40.
38. S string , start
k .
39. 41.
40. S - , C .
41. R - ,
R S.
42. k 1.
43. 4.
http://javascript.ru/ecma[14.03.09 12:52:12]

1
URI RFC2396 .
2
UTF-8 , 2.0,
A .
UTF-8 1 6 .
"" 0,

.
n , n > 1, n 1,
(n+1)- 0.
. 1,
0. 6 .
ECMAScript UTF-8 :

0x0000 - 0x007F
0x0080 - 0x07FF
0x0800 - 0xD7FF
0xD800 - 0xDBFF

0xDC00 - 0xDFFF
0xD800 -0xDBFF

0xDC00 - 0xDFFF
0xDC00 - 0xDFFF
0xE000 - 0xFFFF

1 2 3 4
0zzzzzzz
110yyyyy 10zzzzzz
1110xxxx 10yyyyyy 10zzzzzz

00000000 0zzzzzzz
00000yyy yyzzzzzz
xxxxyyyy yyzzzzzz
110110vv vvwwwwxx
11110uuu 10uuwwww 10xxyyyy 10zzzzzz
110111yy yyzzzzzz
URIError
URIError
xxxxyyyy yyzzzzzz

1110xxxx 10yyyyyy 10zzzzzz

uuuuu

= vvvv +1

0x10000 3.7 ""


2.0. 0xD800-0xDFFF
; UCS-2
UCS-4 21- UTF-8.
.
15.1.3.1 decodeURI(encodedURI)
decodeURI URI, escape UTF-8,
encodeURI , , .
Escape-, encodeURI ,
.
decodeURI
:

encodedURI,

1. ToString( encodedURI).
2. reservedURISet ,
, uriReserved , "#".

http://javascript.ru/ecma[14.03.09 12:52:12]

3. Decode((1), reservedURISet)
4. (3).

"#" escape- ,
URI.
15.1.3.2 decodeURIComponent(encodedURIComponent)
decodeURIComponent URI, escape UTF-8,
encodeURIComponent , ,
.
decodeURIComponentval

encodedURIComponent , :

1. ToString( encodedURIComponent ).
2. reservedURIComponentSet .
3. Decode((1), reservedURIComponentSet )
4. (3).
15.1.3.3 encodeURI(uri)
encodeURI URI,
, , escape,
UTF-8
encodeURI uri ,
:
1. ToString( uri ).
2. unescapedURISet ,
, uriReserved uriUnescaped , "#".
3. Encode(Result(1), unescapedURISet )
4. (3).

"#" escape-,
URI.

15.1.3.4 encodeURIComponent(uriComponent)
encodeURIComponent URI,
, escape-,
UTF-8
http://javascript.ru/ecma[14.03.09 12:52:12]

encodeURIComponent uriComponent,
:
1. ToString( uriComponent).
2. reservedURISet ,
, uriUnescaped .
3. Encode((1), unescapedURIComponentSet)
4. (3).
15.1.4 -
15.1.4.1 Object(...)
. 15.2.1 15.2.2.
15.1.4.2 Function(...)
. 15.3.1 15.3.2.
15.1.4.3 Array(...)
. 15.4.1 15.4.2.
15.1.4.4 String(...)
. 15.5.1 15.5.2.
15.1.4.5 Boolean(...)
. 15.6.1 15.6.2.
15.1.4.6 Number(...)
. 15.7.1 15.7.2.
15.1.4.7 Date(...)
. 15.9.2.
15.1.4.8 RegExp(...)
. 15.10.3 15.10.4.
15.1.4.9 Error(...)
. 15.11.1 15.11.2.
15.1.4.10 EvalError(...)
. 15.11.6.1.
15.1.4.11 RangeError(...)
http://javascript.ru/ecma[14.03.09 12:52:12]

. 15.11.6.2.
15.1.4.12 ReferenceError(...)
. 15.11.6.3.
15.1.4.13 SyntaxError(...)
. 15.11.6.4.
15.1.4.14 TypeError(...)
. 15.11.6.5.
15.1.4.15 URIError(...)
. 15.11.6.6.
15.1.5
15.1.5.1 Math
. 15.8.
15.2 Object
15.2.1 Object
Object
.

15.2.1.1 Object([ value ] )


Object value,
:
1. value null, undefined ,
Object ,
(. 15.2.2.1).
2. ToObject( value).
15.2.2 Object
Object new ,
.
15.2.2.1 new Object([ value ] )
Object
value, :
1. value - 8.
2. value Object - 5.

http://javascript.ru/ecma[14.03.09 12:52:12]

3. value - ECMAScript object,


value.
4. value ,
, , .
5. value String, ToObject( value).
6. value Boolean, ToObject( value).
7. value Number, ToObject( value).
8. ( value Null Undefined.)
ECMAScript.
[[Prototype]] Object.
[[Class]] "Object" .
[[Value]].
.
15.2.3 Object
[[Prototype]] Object
Function.
length ( 1),
Object :
15.2.3.1 Object.prototype
Object.prototype - Object (.
15.2.4).
{ DontEnum, DontDelete, ReadOnly }.
15.2.4 - Object
[[Prototype]] - Object null,
[[Class]] "Object".
15.2.4.1 Object.prototype.constructor
Object.prototype.constructor
Object.

15.2.4.2 Object.prototype.toString()
toString , :
1. [[Class]] .
2. "[object ", (1),
"]".
3. (2).
http://javascript.ru/ecma[14.03.09 12:52:12]

15.2.4.3 Object.prototype.toLocaleString()
toString() . ( ,
toString this ,
toString , 15.2.4.2)

1
,
toLocaleString (" "),
. Array, Number Date ,
toLocaleString .
2
, ,
.
- .
15.2.4.4 Object.prototype.valueOf()
valueOf this.
Object (. 15.2.2.1), valueOf
: this, -
, ,
.
15.2.4.5 Object.prototype.hasOwnProperty(V)
hasOwnProperty V ,
:
1. O .
2. ToString( V ).
3. O , (2), false.
4. true.

[[HasProperty]] (. 8.6.2.4),
.
15.2.4.6 Object.prototype.isPrototypeOf(V)
isPrototypeOf V ,
:
1. O .
2. V - false.
3. V [[Prototype]] V .

http://javascript.ru/ecma[14.03.09 12:52:12]

4. V null - false.
5. O V (.
13.1.2) - true.
6. 3.
15.2.4.7 Object.prototype.propertyIsEnumerable(V)
propertyIsEnum V ,
:
1. O .
2. ToString( V ).
3. O , (2), false.
4. DontEnum - false.
5. true.

.
15.2.5 Object
Object , ,
- Object.
15.3 Function
15.3.1 Function
Function , ,
Function. ,
Function(...) new Function(...) ,
.
15.3.1.1 Function(p1, p2, ... , pn, body)
Function p1, p2,..., pn, body
( n 0 - .. "p", body
), :
1. Function,
(15.3.2.1).
15.3.2 Function
Function new , , ..
.
15.3.2.1 new Function(p1, p2, ... , pn, body)

http://javascript.ru/ecma[14.03.09 12:52:12]

(
.

Function p1, p2,..., pn,


body ( n 0 - .. "p", body
), :
1. P - .
2. - body
13.
3. - body
13.
4. (4) .
5. P ToString((4)).
6. k 2.
7. k , body k- 13.
8. (8) k- .
9. ToString((8)).
10. P P, ","
() (9).
11. k 1.
12. 7.
13. ToString( body ).
14. P -
SyntaxError.
15. body -
SyntaxError.
16.

,

.

Function 13.2 ,
P ,
body .
,

17. (16).
prototype
.

http://javascript.ru/ecma[14.03.09 12:52:12]


, ,
. ,
:
new Function("a", "b", "c", "return a+b+c")
new Function("a, b, c", "return a+b+c")
new Function("a,b", "c", "return a+b+c")

15.3.3 Function
[[Prototype]] Function Function (. 15.3.4).
length ( 1),
Function :
15.3.3.1 Function.prototype
Function.prototype - Function (.
15.3.4).
{ DontEnum, DontDelete, ReadOnly }.
15.3.4 - Function
- Function Function ( [[Class]]
, ,
undefined.
"Function")

[[Prototype]] - Function
- Object (15.3.2.1).
" ". , undefined.
- Function valueOf,
valueOf - Object.
15.3.4.1 Function.prototype.constructor
Function.prototype.constructor
Function .
15.3.4.2 Function.prototype.toString()

. . , ,
,
.
toString . TypeError,
this Function. ,
http://javascript.ru/ecma[14.03.09 12:52:12]

.
15.3.4.3 Function.prototype.apply(thisArg, argArray)
apply , thisArg argArray,
[[Call]] .
[[Call]], TypeError.
thisArg null undefined, this
. this
ToObject( thisArg ).
argArray null undefined, .
, argArray , (.
10.1.8), TypeError. argArray
, (ToUint32( argArray. length))
argArray[ 0], argArray[ 1], ..., argArray[ ToUint32( argArray. length)- 1].
length apply 2.
15.3.4.4 Function.prototype.call(thisArg [ , arg1 [ , arg2, ... ] ] )
call , thisArg () arg1, arg2
.., [[Call]]
. [[Call]], TypeError.
arg1, arg2 ..
thisArg null undefined, this
. this
ToObject( thisArg ).
length call 1.
15.3.5 Function
,
[[Call]], [[Construct]] [[Scope]] (. 8.6.2 13.2).
[[Class]] "Function".
15.3.5.1 length
length , ""
, .
. ,
length , .
{ DontDelete, ReadOnly, DontEnum }.
15.3.5.2 prototype
prototype ,
[[Prototype]] , Function
. { DontDelete}.

http://javascript.ru/ecma[14.03.09 12:52:12]

15.3.5.3 [[HasInstance]](V)
, F Function.
[[HasInstance]] F V ,
:
1. V - false.
2. [[Get]] F "prototype".
3. O (2).
4. O - TypeError.
5. V [[Prototype]] V .
6. V null - false.
7. O V (.
13.1.2) - true.
8. 5.
15.4 Array
Array ()
. P ( )
, ToString(ToUint32( P))
P ToUint32( P) 2 32 - 1. Array
length, , ,
2 32 . length ,
. Array
,
. , ,
, length, , ,
. length, ,
, , length,
.
Array length - ,
.
15.4.1 Array
Array , ,
Array. , Array(...)
new Array(...) , .
15.4.1.1 Array([ item1[, item2 [,...]]])
Array , :
1. Array,
http://javascript.ru/ecma[14.03.09 12:52:12]

(15.4.2).
15.4.2 Array
Array new , , ..
.
15.4.2.1 new Array([ item0[, item1 [,...]]])
, Array
, .
[[Prototype]]
- Array, .. ,
Array.prototype (. 15.4.3.1).
[[Class]] "Array".
length .
0 item0 (
), 1 item1
( ) : k
k ,
0.
15.4.2.2 new Array(len)
[[Prototype]]
- Array, .. ,
Array.prototype (. 15.4.3.1). [[Class]]
"Array".
len Number ToUint32( len ) len , length
ToUint32( len ). len
Number ToUint32( len ) len - RangeError.
len Number, length
1, 0 len .
15.4.3 Array
[[Prototype]] Array Function (. 15.3.4).
length ( 1),
Array :
15.4.3.1 Array.prototype
Array.prototype - Array (. 15.4.4).
{ DontEnum, DontDelete, ReadOnly }.
http://javascript.ru/ecma[14.03.09 12:52:12]

15.4.4 - Array
[[Prototype]] - Array Object (15.2.3.1).
- Array . [[Class]] "Array",
length ( +0)
[[Put]], 15.2.3.1.
, - Array,
" " this,
. , this ,
[[Class]] "Array".

- Array
valueOf - Object .

valueOf ,

15.4.4.1 Array.prototype.constructor
Array.prototype.constructor Array .
15.4.4.2 Array.prototype.toString()
join
.
toString . TypeError,
this Array. ,
.
15.4.4.3 Array.prototype.toLocaleString()

toLocaleString . , ,
. ,
toString, , ,
.
:
1. [[Get]] "length".
2. ToUint32((1)).
3. separator - ,
(
).
4. ToString( separator).
5. (2) - .
http://javascript.ru/ecma[14.03.09 12:52:12]

6. [[Get]] "0".
7. (6) undefined null - .
ToObject(Result(6)). toLocaleString().
8. R (7).
9. k 1.
10. k (2), R .
11. S , R (4).
12. [[Get]] ToString( k ).
13. (12) undefined null - .
ToObject(Result(12)). toLocaleString().
14. R , S (13).
15. k 1.
16. 10.
toLocaleString . TypeError,
this Array. ,
.

, ,
.
- .
15.4.4.4 Array.prototype.concat([ item1[, item2 [,...]]])
concat item1, item2 . .,
, ,
.
:
1. A - , new Array().
2. n 0.
3. E .
4. E Array - 16.
5. k 0.
6. [[Get]] E "length".
7. k (6) - 19.
http://javascript.ru/ecma[14.03.09 12:52:12]

8. ToString( k ).
9. E , (8), -
10. - 13.
10. ToString(n).
11. [[Get]] E (8).
12. [[Put]] A (10) (11).
13. n 1.
14. k 1.
15. 7.
16. ToString( n).
17. [[Put]] A (16) E.
18. n 1.
19. . 22.
20. E (19).
21. 4.
22. [[Put]] A "length" n.
23. A .
length concat 1.

concat . ,
this Array. ,
.
concat .
15.4.4.5 Array.prototype.join(separator)
. ,
separator. ,
.
join , separator, :
1. [[Get]] "length".
2. ToUint32((1)).

http://javascript.ru/ecma[14.03.09 12:52:12]

3. separator undefined, separator


",".
4. ToString( separator).
5. (2) - .
6. [[Get]] "0".
7. (6) undefined null - .
ToString((6)).
8. R (7).
9. k 1.
10. k (2), R .
11. S , R (4).
12. [[Get]] ToString( k ).
13. (12) undefined null - .
ToString((12)).
14. R , S (13).
15. k 1.
16. 10.
length join 1.

join . ,
this Array. ,
.
join .
15.4.4.6 Array.prototype.pop()
.
1. [[Get]] "length".
2. ToUint32((1)).
3. (2) - 6.
4. [[Put]] "length" (2).
5. undefined.
6. ToString((2) - 1).
http://javascript.ru/ecma[14.03.09 12:52:12]

7. [[Get]] (6).
8. [[Delete]] (6).
9. [[Put]] "length" ((2) - 1).
10. (7).

pop . ,
this Array. ,
.
pop .
15.4.4.7 Array.prototype.push([ item1[, item2 [,...]]])
,
. .
push item1, item2 ..,
:
1. [[Get]] "length".
2. n ToUint32((1)).
3. . 7.
4. [[Put]] ToString( n) (3).
5. n 1.
6. 3.
7. [[Put]] "length" n.
8. n.
length push 1.

push . ,
this Array. ,
.
join .
15.4.4.8 Array.prototype.reverse()
, .
.
1. [[Get]] "length".

http://javascript.ru/ecma[14.03.09 12:52:12]

2. ToUint32((1)).
3. floor((2)/ 2).
4. k 0.
5. k (3), .
6. (2)- k -1.
7. ToString( k ).
8. ToString((6)).
9. [[Get]] (7).
10. [[Get]] (8).
11. , (8) 19.
12. , (7) 16.
13. [[Put]] (7) (10).
14. [[Put]] (8) (9).
15. 25.
16. [[Put]] (7) (10).
17. [[Delete]] , (8)
, .
18. 25.
19. , (7) 23.
20. [[Delete]] , (7)
, .
21. [[Put]] (8) (9).
22. 25.
23. [[Delete]] , (7)
, .
24. [[Delete]] , (8)
, .
25. k 1.
http://javascript.ru/ecma[14.03.09 12:52:12]

26. 5.

reverse . ,
this Array. ,
.
reverse .
15.4.4.9 Array.prototype.shift()
.
1. [[Get]] "length".
2. ToUint32((1)).
3. (2) - 6.
4. [[Put]] "length" (2).
5. undefined.
6. [[Get]] "0" .
7. k 1.
8. k (2) - 18.
9. ToString( k ).
10. ToString( k -1).
11. , Result(9) 12. - 15.
12. [[Get]] (9).
13. [[Put]] (10) (12).
14. 16.
15. [[Delete]] (10).
16. k 1.
17. 8.
18. [[Delete]] ToString((2)-1).
19. [[Put]] "length" ((2) - 1).
20. (6).

shift . ,
http://javascript.ru/ecma[14.03.09 12:52:12]

this Array. ,
.
shift .
15.4.4.10 Array.prototype.slice(start, end)
slice start end ,
, start end
( , end undefined). start ,
(length+ start ), length .
end , (length+ end), length
. :
1. A - , new Array().
2. [[Get]] "length".
3. ToUint32((2)).
4. ToInteger( start ).
5. (4) ,
(4)), 0). min((4), (3)).

max(((3)+

6. k (5).
7. end
ToInteger( end).

undefined,

(3).

8. (7) , max((Result(3)+
Result(7)), 0); min((7), (3)).
9. n 0.
10. k (8) - 19.
11. ToString( k ).
12. , Result(11) 13. - 15.
13. ToString( n).
14. [[Get]] (11).
15. [[Put]] A (13) (14).
16. k 1.
17. n 1.
18. 10.
19. [[Put]] A "length" n.
http://javascript.ru/ecma[14.03.09 12:52:12]

20. A .
length slice 2.

slice
this

slice

. ,
Array. ,
.
.

15.4.4.11 Array.prototype.sort(comparefn)
. (..
, ,
). comparefn undefined, ,
x y x < y ,
x = y x > y .
comparefn undefined
(. ), sort .
len ToUint32( this.length). i j P ,
, sort :
0 <= i < len
0 <= j < len
this ToString( i)
P
[[Prototype]], this .
P ToString( j)
.
1. [[Get]] "length".
2. ToUint32((1)).
3. [[Get]],
[[Put]] [[Delete]] SortCompare ( ),
[[Get]], [[Put]] [[Delete]]
, Result(2),
SortCompare [[Get]].
4. .
.
,
, , (2), ,
j, , (2), [j]
, [(j)] , [j],
old[j] , new[(j)] .
j k ,
http://javascript.ru/ecma[14.03.09 12:52:12]

(2), SortCompare( j, k )< 0 (. SortCompare ), (j)<


(k).
[j]
[[Get]] j ,
, new[j] -
[[Get]] j .
comparefn
S, a, b c
(, ) S: a <CF b ,
comparefn(a, b)< 0, a =CF b , comparefn(a, b ) = 0 ( ), a >CF b
, comparefn(a, b)> 0.
comparefn(a, b ) v ,
a b .
, v Number, v NaN. , ,
a <CF b, a =CF b , a >CF b
a b .
a =CF a ()
a =CF b , b =CF a ()
a =CF b b =CF c , a =CF c ( =CF)
a <CF b b <CF c , a <CF c ( <CF)
a >CF b b >CF c , a >CF c ( >CF)

, comparefn
S
.
SortCompare j k ,
:
1. ToString( j).
2. ToString( k ).
3. , (1),
, (2) - +0.
4. , (1) 1.
5. , (2) -1.
6. [[Get]] (1).
7. [[Get]] (2).
8. x (6).
http://javascript.ru/ecma[14.03.09 12:52:12]

9. y (7).
10. x y undefined - +0.
11. x undefined - 1.
12. y undefined - -1.
13. comparefn undefined - 16.
14. comparefn x y .
15. (14).
16. ToString( x).
17. ToString( y ).
18. (16) < (17) - -1.
19. (16) > (17) - 1.
20. +0.

1
, undefined,
undefined , - ,
undefined
.
2
sort . ,
this Array. ,
.
sort .
15.4.4.12 Array.prototype.splice(start, deleteCount [, item1 [, item2[,...]]])
splice start, deleteCount
() item1, item2 .., deleteCount start
item1, item2 . :
1. A - , new Array().
2. [[Get]] "length".
3. ToUint32((2)).
4. ToInteger( start ).
5. (4) ,
(4)), 0). min((4), (3)).

max(((3)+

6. min(max(ToInteger( deleteCount ), 0), (3)-(5)).


http://javascript.ru/ecma[14.03.09 12:52:12]

7. k 0.
8. k (6) - 16.
9. ToString((5)+ k ).
10. (9) - 11.
- 14.
11. ToString( k ).
12. [[Get]] (9).
13. [[Put]] A (11) (12).
14. k 1.
15. 8.
16. [[Put]] A "length" (6).
17. item1, item2, ..
18. (17) (6) - 48.
19. (17) (6) - 37.
20. k (5).
21. k ((3)-(6)) - 31.
22. ToString( k+ (6)).
23. ToString( k+ (17)).
24. (22) - 25.
28.
25. [[Get]] (22).
26. [[Put]] (23) (25).
27. 29.
28. [[Delete]] (23).
29. k 1.
30. 21.
31. k (3).
32. k ((3)-(6)+(17)) - 48.

http://javascript.ru/ecma[14.03.09 12:52:12]

33. ToString( k -1).


34. [[Delete]] (33).
35. k 1.
36. 32.
37. k ((3)-(6)).
38. k (5) - 48.
39. ToString( k +(6)-1).
40. ToString( k +(17)-1).
41. , Result(39) 42. - 45.
42. [[Get]] (39).
43. [[Put]] (40) (42).
44. 46.
45. [[Delete]] (40).
46. k 1.
47. 38.
48. k (5).
49. ,
item1. - 53.
50. [[Put]] ToString( k ) (49).
51. k 1.
52. 49.
53. [[Put]] "length" ((3) (6) + (17)).
54. A .
length splice 2.

splice . ,
this Array. ,
.
splice .
http://javascript.ru/ecma[14.03.09 12:52:12]

15.4.4.13 Array.prototype.unshift([ item1[, item2 [,...]]])


,
, .
unshift item1, item2 ..,
:
1. [[Get]] "length".
2. ToUint32((1)).
3. .
4. k (2).
5. k - 15.
6. ToString( k -1).
7. ToString( k +(3)-1).
8. , Result(6) -
9. - 12.
9. [[Get]] (6).
10. [[Put]] (7) (9).
11. 13.
12. [[Delete]] (7).
13. k 1.
14. 5.
15. k 0.
16. ,
item1. - 21.
17. ToString( k ).
18. [[Put]] (17) (16).
19. k 1.
20. 16.
[[Put]]
21.

((2)+(3)).

22. ((2)+(3)).
http://javascript.ru/ecma[14.03.09 12:52:12]

"length"

length unshift 1.

unshift . ,
this Array. ,
.
unshift .
15.4.5 Array
Array - Array,
:
15.4.5.1 [[Put]](P, V)
Array [[Put]], ,
ECMAScript (. 8.6.2.2).
, A - Array, P - . [[Put]] A
P V , :
1. [[CanPut]] A , P.
2. (1) false - .
3. A P - 7.
4. P "length" - 12.
5. P A V .
6. 8.
7. P, V
.
8. P - .
9. ToUint32( P) , length A - .
10. ( ) length A ToUint32( P)+1.
11. .
12. ToUint32( V ).
13. (12) ToNumber( V ) - RangeError.
14. arg , length A ,
, (12), A ( )
ToString( k ) - .
15. P A (12).

http://javascript.ru/ecma[14.03.09 12:52:12]

16. .
15.4.5.2 length
length Array ,
, .
length { DontEnum, DontDelete }.
15.5 String
15.5.1 String
String
.

15.5.1.1 String([ value ] )


( String), ToString( value).
value , "".
15.5.2 String
String new , , ..
.
15.5.2.1 new String([ value ] )
[[Prototype]]
- String, .. ,
String.prototype (. 15.5.3.1).
[[Class]] "String" .
[[Value]] ToString( value)
, value .
15.5.3 String
[[Prototype]] String Function (. 15.3.4).
length ( 1),
String :
15.5.3.1 String.prototype
String.prototype - String (.
15.5.4).
{ DontEnum, DontDelete, ReadOnly }.
15.5.3.2 String.fromCharCode([ char0[, char1 [,...]]])
, , .
http://javascript.ru/ecma[14.03.09 12:52:12]

.
, ..
ToUint16 (9.7)
16- .
, .
length fromCharCode 1.
15.5.4 - String
- String String ( [[Class]] "String") ,
.
[[Prototype]] - String Object (15.2.3.1).
15.5.4.1 String.prototype.constructor
String.prototype.constructor
String.

15.5.4.2 String.prototype.toString()
. (, String toString
, valueOf.)
toString . TypeError,
this String. ,
.
15.5.4.3 String.prototype.valueOf()
.
valueOf . TypeError,
this String. ,
.
15.5.4.4 String.prototype.charAt(pos)
, , pos ,
.
, .
( String).
pos Number, x.charAt( pos )
x.substring( pos, pos+ 1).
charAt pos ,
:
1. ToString, this .
2. ToInteger( pos ).
http://javascript.ru/ecma[14.03.09 12:52:12]

3. (1).
4. (2) 0 (3) - .
5. 1, (1),
(2). () (1)
0, - 1 .

charAt . ,
this String. ,
.
15.5.4.5 String.prototype.charCodeAt(pos)
( , 2 16 ),
pos ,
. ,
NaN.
charCodeAt pos ,
:
1. ToString, this .
2. ToInteger( pos ).
3. (1).
4. (2) 0 (3) - NaN.
5. Number,
(2) (1). () (1)
0, - 1 .

charCodeAt . ,
this String. ,
.
15.5.4.6 String.prototype.concat([ string1[, string2 [,...]]])
concat item1, item2 . .,
, ( ),
string1, string2 .. (
).
( String). :
1. ToString, this .
2. R (1).

http://javascript.ru/ecma[14.03.09 12:52:12]

3. . 7.
4. ToString((3)).
5. R - , R ,
(4).
6. 3.
7. R .
length concat 1.

concat . ,
this String. ,
.
15.5.4.7 String.prototype.indexOf(searchString, position)
searchString
, position ,
. -1.
position undefined, 0
.
indexOf , searchString position
:
1. ToString, this .
2. ToString( searchString ).
3. ToInteger( position ). ( position undefined,
0).
4. (1).
5. min(max((3), 0), (4)).
6. , (2).
7. k , , (5), , k+
(6) , (4), j, ,
(6), k+j (1) j
(2). k - -1.
8. (7).
length indexOf 1.

indexOf . ,
http://javascript.ru/ecma[14.03.09 12:52:12]

this String. ,
.
15.5.4.8 String.prototype.lastIndexOf(searchString, position)
searchString
, position ,
. -1.
position undefined,
.
lastIndexOf , searchString position
:
1. ToString, this .
2. ToString( searchString ).
3. ToNumber( position ). ( position undefined,
NaN).
4.

(3)
ToInteger((3)).

NaN

+.

5. (1).
6. min(max((4), 0), (5)).
7. , (2).
8. k , ,
(6), , k+ (7) , (5),
j, , (7), k+j
(1) j (2). k
- -1.
9. (8).
length lastIndexOf 1.

lastIndexOf . ,
this String. ,
.
15.5.4.9 String.prototype.localeCompare(that)
localeCompare that, ,
NaN,
(
) that ( ).
. ,
, ,
http://javascript.ru/ecma[14.03.09 12:52:12]

, , this
that , this that
.
localeCompare , this that,
( 15.4.4.11)
. , localeCompare 0 -0,
,
.
,
- ,

0,

,

.

1
localeCompare
Array.prototype.sort , .
2
,

, ECMAScript

. , ,
,
( , ,
C D). ,
.
,
.
3
localeCompare . ,
this String. ,
.
4
, ,
.
- .
15.5.4.10 String.prototype.match(regexp)
regexp , [[Class]]
"RegExp", new RegExp(
regexp ). string this .
:
regexp . global false - RegExp.prototype.exec (.
15.10.6.2) regexp string .
http://javascript.ru/ecma[14.03.09 12:52:12]

regexp . global true - regexp.lastIndex 0


RegExp.prototype.exec, .
( , regexp .
lastIndex ), regexp . lastIndex 1. n -
. n=0 - null . ,
length n 0 n-1

RegExp.prototype.exec, .

match . ,
this String. ,
.
15.5.4.11 String.prototype.replace(searchValue, replaceValue)
string this .
searchValue - (.. , [[Class]]
"RegExp" ), : searchValue . global false string
searchValue . searchValue .global true - string
searchValue .
, String.prototype.match, searchValue . lastIndex.
m - searchValue
(NCapturingParens 15.10.2.1).
searchValue - , searchString =
ToString( searchValue ) string
searchString . m 0.
replaceValue - ,
m + 3 . 1 - . searchValue , m
MatchResult (. 15.10.2.1). m + 2 string ,
, m + 3 string .
,
,
.
, newstring replaceValue .
,
, newstring
newstring .
$- : ,
. ,
"$1,$2".replace(/(\$(\d))/g, "$$1-$1$2") "$1-$11,$1-$22". $ newstring ,
, ,
.

$$

http://javascript.ru/ecma[14.03.09 12:52:12]

$&
$`
$'

$n

$nn

.
string , .
string , .
n- , n - 1 9 $n
. n <= m, n-
undefined - . n> m -
.
nn- , nn - 01
99. nn<= m, nn- undefined -
. nn> m - .

replace . ,
this String. ,
.
15.5.4.12 String.prototype.search(regexp)
regexp , [[Class]]
"RegExp", new RegExp(
regexp ). string this .
string regexp .
, string
, -1 , .

1
lastIndex
regexp .

global

regexp.

lastIndex

2
charAt . ,
this String. ,
.
15.5.4.13 String.prototype.slice(start, end)
slice start end,
, start
end ( ,
end undefined). start ,
(sourceLength+ start ), sourceLength . end
, (sourceLength+ end), sourceLength
. ( String).
:
1. ToString, this .
2. (1).
3. ToInteger( start ).

http://javascript.ru/ecma[14.03.09 12:52:12]

4. end
ToInteger( end).

undefined,

(2).

5. (3) ,
(3)), 0). min((3), (2)).

max(((2)+

6. (4) ,
(4)), 0). min((4), (2)).

max(((2)+

7. max((6)- (5), 0).


8. , (7)
(1), (5).

length slice 2.

slice . ,
this String. ,
.
15.5.4.14 String.prototype.split(separator, limit)
Array,
.
separator;
, .
separator RegExp (. . ,
[[Class]] "RegExp"; . 15.10).
separator ,
, . separator

.
(, separator ,
,
.) separator - ,
this ,
. (,
"ab".split(/a*?/) ["a","b"] , "ab".split(/a*/) [""," b"]).
this ( ) , ,
separator . ,
. ,
.
separator ,
, , separator ,
( undefined)

.
(,
"A<B>bold</B>and<CODE>coded</CODE>".split(/<(\/)?([^<>]+)>/) ["A", undefined,
"B", "bold", "/", "B", "and", undefined, "CODE", "coded", "/", "CODE", ""].)

http://javascript.ru/ecma[14.03.09 12:52:12]

separator undefined,
, this ( ). limit
undefined, , limit
.
split , :
1. S = ToString( this ).
2. A - , new Array().
3. limit undefined, lim =232 -1, lim =
ToUint32( limit).
4. s - S.
5. p =0.
6. separator - RegExp ( [[Class]]
R = separator, R = ToString( separator).

"RegExp"),

7. lim = 0 - A.
8. separator undefined - 33.
9. s = 0 - 31.
10. q = p .
11. q = s - 28.
12. SplitMatch(R, S, q) z ( MatchResult).
13. z failure - 26.
14. z State. e endIndex z cap
captures z .
15. e = p - 26.
16. T - , S,
p () q ( ).
17. [[Put]] A A.length T.
18. A.length = lim - A.
19. p = e.
20. i =0.
21. i cap - 10.
22. i = i + 1.
http://javascript.ru/ecma[14.03.09 12:52:12]

23. [[Put]] A A . length cap[i] .


24. A . length = lim - A.
25. 21.
26. q = q + 1.
27. 11.
28. T - , S,
p () s ().
29. [[Put]] A A . length T .
30. A .
31. SplitMatch(R, S, 0) z ( MatchResult).
32. z failure - A.
33. [[Put]] A "0" S.
34. A .
SplitMatch ( S,
q RegExp R ) ,
MatchResult (. 15.10.2.1):
1. R - RegExp ( [[Class]] "RegExp" ) - 8.
2. R . r - R .
3. s - S.
4. q + r > s - MatchResult failure.
5. i 0 () r ( ), ,
S q + i R i -
failure.
6. cap - (. 15.10.2.1).
7. State ( q + r, cap ). (. 15.10.2.1)
8. [[Match]] R , S q ,
MatchResult.
length split 2.

1
split . ,
this String. ,
.
http://javascript.ru/ecma[14.03.09 12:52:12]

2
split separator.
RegExp .

global

, separator -

15.5.4.15 String.prototype.substring(start, end)


substring start end
,
start end (
, end undefined). ,
String.
- NaN , 0.
- , .
start end, . :
1. ToString, this .
2. (1).
3. ToInteger( start ).
4. end
ToInteger( end).

undefined,

(2).

5. min(max((3), 0), (2)).


6. min(max((4), 0), (2)).
7. min((5), (6)).
8. max((5), (6)).
9. , (8)
(7), (1),
(7) (8) - 1, .
length substring 2.

substring . ,
this String. ,
.
15.5.4.16 String.prototype.toLowerCase()
, .
.
( String).
.
,
http://javascript.ru/ecma[14.03.09 12:52:12]

. .

1

( UnicodeData. txt,
SpecialCasings. txt, 2.1.8 ).
2
toLowerCase . ,
this String. ,
.
15.5.4.17 String.prototype.toLocaleLowerCase()
toLowerCase, ,
,
.
(, ),
.

1
toLocaleLowerCase . ,
this String. ,
.
2
, ,
.
- .
15.5.4.18 String.prototype.toUpperCase()
String.prototype.toLowerCase ,
,
.

1
toUpperCase, toLowerCase ,
. , s.toUpperCase().
toLowerCase()

s.toLowerCase().
2
toUpperCase . ,
this String. ,
.
15.5.4.19 String.prototype.toLocaleUpperCase()
toUpperCase, ,
,
.
(, ),
.
http://javascript.ru/ecma[14.03.09 12:52:12]

1
toLocaleUpperCase . ,
this String. ,
.
2
, ,
.
- .
15.5.5 String
String - String,
[[Value]] length.
[[Value]] ,
String.
15.5.5.1 length
, String.
String .
{ DontEnum, DontDelete, ReadOnly }.
15.6 Boolean
15.6.1 Boolean
Boolean
.

15.6.1.1 Boolean(value)
( Boolean), ToBoolean( value).
15.6.2 Boolean
Boolean new , , ..
.
15.6.2.1 new Boolean(value)
[[Prototype]]
- Boolean, .. ,
Boolean.prototype (. 15.6.3.1).
[[Class]] "Boolean" .
[[Value]] ToBoolean( value).
15.6.3 Boolean
[[Prototype]] Boolean http://javascript.ru/ecma[14.03.09 12:52:12]

Function (. 15.3.4).
length ( 1),
Boolean :
15.6.3.1 Boolean.prototype
Boolean.prototype - Boolean (.
15.6.4).
{ DontEnum, DontDelete, ReadOnly }.
15.6.4 - Boolean
- Boolean Boolean ( [[Class]]
false.

"Boolean") ,

[[Prototype]]
- Object (15.2.3.1).

Boolean

, -
Boolean, " Boolean" this,
. this ,
[[Class]] "Boolean" ,
TypeError. " "
, Boolean, ..
[[Value]] Boolean.
15.6.4.1 Boolean.prototype.constructor
Boolean.prototype.constructor
Boolean .
15.6.4.2 Boolean.prototype.toString()
true, "true". ,
false "false".
toString . TypeError,
this Boolean. ,
.
15.6.4.3 Boolean.prototype.valueOf()
.
valueOf . TypeError,
this Boolean. ,
.
15.6.5 Boolean
Boolean , ,
- Boolean.
http://javascript.ru/ecma[14.03.09 12:52:12]

15.7 Number
15.7.1 Number
Number
.

15.7.1.1 Number([ value ] )


( Number), ToNumber( value).
value , +0.
15.7.2 Number
Number new , , ..
.
15.7.2.1 new Number([ value ] )
[[Prototype]]
- Number, .. ,
Number.prototype (. 15.7.3.1).
[[Class]] "Number" .
[[Value]] ToNumber( value).
value , +0.
15.7.3 Number
[[Prototype]] Number Function (. 15.3.4).
length ( 1),
Number :
15.7.3.1 Number.prototype
Number.prototype - Number (.
15.7.4).
{ DontEnum, DontDelete, ReadOnly }.
15.7.3.2 Number.MAX_VALUE
Number.MAX_VALUE
, 1.7976931348623157 * 10 308 .
{ DontEnum, DontDelete, ReadOnly }.
15.7.3.3 Number.MIN_VALUE
Number.MIN_VALUE
, 5 * 10 -324 .
http://javascript.ru/ecma[14.03.09 12:52:12]

{ DontEnum, DontDelete, ReadOnly }.


15.7.3.4 Number.NaN
Number.NaN NaN.
{ DontEnum, DontDelete, ReadOnly }.
15.7.3.5 Number.NEGATIVE_INFINITY
Number.NEGATIVE_INFINITY -.
{ DontEnum, DontDelete, ReadOnly }.
15.7.3.6 Number.POSITIVE_INFINITY
Number.POSITIVE_INFINITY +.
{ DontEnum, DontDelete, ReadOnly }.
15.7.4 - Number
- Number Number ( [[Class]]
"Number" ), +0.
[[Prototype]]
- Object (15.2.3.1).

Number

, -
Number, " Number" this,
. this ,
[[Class]] "Number" ,
TypeError. " "
, Number, ..
[[Value]] Number.
15.7.4.1 Number.prototype.constructor
Number.prototype.constructor
Number.

15.7.4.2 Number.prototype.toString(radix)
radix 10 undefined,
ToString.
.
radix - 2 36, 10, ,
.
toString . TypeError,
this Number. ,
.
http://javascript.ru/ecma[14.03.09 12:52:12]

15.7.4.3 Number.prototype.toLocaleString()
, Number,
.
, ( )
, toString .

, ,
.
- .
15.7.4.4 Number.prototype.valueOf()
.
valueOf . TypeError,
this Number. ,
.
15.7.4.5 Number.prototype.toFixed(fractionDigits)
, ,
, fractionDigits . fractionDigits
undefined, 0. :
1. f ToInteger( fractionDigits ). ( fractionDigits undefined,
0).
2. f < 0 f > 20 - RangeError.
3. x - .
4. x NaN - "NaN" .
5. s - .
6. x >= 0 - 9.
7. s "-".
8. x =- x.
9. x >= 10 21 , m = ToString( x) 20.
10. n - , n 10 f - x
0. n, .
11. n =0, m "0" . , m ,
n ( , ).
12. f =0 - 20.

http://javascript.ru/ecma[14.03.09 12:52:12]

13. k - m.
14. k > f - 18.
15. z - , f+ 1 - k '0'.
16. m - z m.
17. k = f + 1.
18. a - k - f m, b - f m.
19. m - a, ".", b .
20. s m.
length toFixed 1.
toFixed ,
(. 15).
toFixed fractionDigits
0 20. toFixed
RangeError .

toFixed , toString ,
toString ,
, . ,
(1000000000000000128).toString()

"1000000000000000100",

(1000000000000000128).toFixed(0) "1000000000000000128".
15.7.4.6 Number.prototype.toExponential(fractionDigits)
, ,
, fractionDigits . fractionDigits
undefined - ,
( , ToString, ,
).
:
1. x - .
2. f ToInteger( fractionDigits ).
3. x NaN - "NaN" .
4. s - .
5. x >= 0 - 8.
6. s "-".
7. x =- x.
http://javascript.ru/ecma[14.03.09 12:52:12]

8. x = +, m = "Infinity" 30.
9. fractionDigits undefined - 14.
10. f < 0 f > 20 - RangeError.
11. x = 0 - 16.
12. e n - , 10 f <= n <10f+1 ,
n * 10 e- f - x 0.
e n - e n, n * 10 e- f .
13. 20.
14. x != 0 - 19.
15. f = 0.
16. m - , f + 1 '0'.
17. e = 0.
18. 21.
19. e, n f - , , f >= 0, 10 f <= n <10f+ 1 , n
* 10 e- f x f . ,
n f + 1 , n 10,
n .
20. m - , n ( , ).
21. f = 0 - 24.
22. a - m, b - f m.
23. m - a, ".", b .
24. e =0 - c = "+" , d = "0" 29.
25. e > 0 - c = "+" 28.
26. c = "-".
27. e =- e.
28. d - , e ( ,
).
29. m - m, "e", c d .
30. s m. length toExponential
1.

http://javascript.ru/ecma[14.03.09 12:52:12]

toExponential ,
(. 15).
toExponential fractionDigits
0 20. toExponential
RangeError .

, ,
,
19:
e, n f - , f >= 0, 10 f <= n <10f+1 , n * 10 e-f
x f .
n - , n *
10 e-f x. n .
15.7.4.7 Number.prototype.toPrecision(precision)
, ,
precision-1
, precision . precision
undefined - ToString (. 9.8.1)
. :
1. x - .
2. precision undefined - ToString( x).
3. p ToInteger( precision).
4. x NaN - "NaN" .
5. s - .
6. x >= 0 - 9.
7. s "-".
8. x = - x.
9. x = +, m = "Infinity" 30.
10. p <1 p > 21 - RangeError.
11. x != 0 - 15.
12. m - , p '0'.
13. e = 0.
14. 18.
http://javascript.ru/ecma[14.03.09 12:52:12]

15. e n - , 10 p -1 <= n <10p ,


n * 1 0e-p +1 - x 0.
e n - e n, n * 10 e-p +1 .
16. m - , n ( , ).
17. e <-6 e >= p - 22.
18. e = p -1 - 30.
19. e >= 0, m e + 1 m, '. '
p-(e +1) m 30.
20. m - "0.", -( e+1) '0' m.
21. 30.
22. a - m, b - p -1 m.
23. m - a, ".", b .
24. e =0 - c = "+" , d = "0" 29.
25. e > 0 - c = "+" 28.
26. c = "-".
27. e =- e.
28. d - , e ( ,
).
29. m - m, "e", c d .
30. s m.
length toPrecision 1.
toPrecision ,
(. 15).
toPrecision precision
1 21. toPrecision
RangeError .
15.7.5 Number
Number , ,
- Number.
15.8 Math
Math - , ,
.
http://javascript.ru/ecma[14.03.09 12:52:12]

[[Prototype]] Math -
Object (15.2.3.1). [[Class]] Math "Math".
Math [[Construct]]. Math
new .
Math [[Call]]. Math .

" x" ,
8.5 .
15.8.1 - Math
15.8.1.1 E
e, ,
2.7182818284590452354.
{ DontEnum, DontDelete, ReadOnly }.
15.8.1.2 LN10

2.302585092994046.

10,

{ DontEnum, DontDelete, ReadOnly }.


15.8.1.3 LN2

0.6931471805599453.

2,

{ DontEnum, DontDelete, ReadOnly }.


15.8.1.4 LOG2E
e ( ) 2,
1.4426950408889634.
{ DontEnum, DontDelete, ReadOnly }.

Math.LOG2E

Math.LN2 .

15.8.1.5 LOG10E
e ( ) 10,
0.4342944819032518.
{ DontEnum, DontDelete, ReadOnly }.

http://javascript.ru/ecma[14.03.09 12:52:12]

Math.LOG10E

Math.LN10 .

15.8.1.6 PI
, ,
3.1415926535897932.
{ DontEnum, DontDelete, ReadOnly }.
15.8.1.7 SQRT1_2

0.7071067811865476.

1/2,

{ DontEnum, DontDelete, ReadOnly }.

Math.SQRT1_

Math.SQRT2 .

15.8.1.8 SQRT2

1.4142135623730951.

2,

{ DontEnum, DontDelete, ReadOnly }.


15.8.2 - Math
, , ToNumber
( , )
(-).
, NaN, -0, +0, - +
, 8.5.

acos, asin, atan, atan2, cos, exp, log, pow, sin sqrt
,
,
, .

,
. , ,
ECMAScript
,
C .
, (
),
IEEE 754, fdlibm,

Sun
Microsystems ( fdlibm
comment@sunpro.eng.sun.com).
,
http://javascript.ru/ecma[14.03.09 12:52:12]

, .
15.8.2.1 abs(x)
x; , x,
.
x NaN - NaN.
x -0 - +0.
x - - +.
15.8.2.2 acos(x)
x.
+0 +.

x
x
x
x

NaN - NaN.
1 - NaN.
-1 - NaN.
1 - +0.

15.8.2.3 asin(x)
x.
-/2 +/2.

x
x
x
x
x

NaN - NaN.
1 - NaN.
-1 - NaN.
+0 - +0.
-0 - -0.

15.8.2.4 atan(x)
x.
-/2 +/2.

x
x
x
x
x

NaN - NaN.
+0 - +0.
-0 - -0.
+ - +/2.
+ - -/2.

15.8.2.5 atan2(y, x)
y/x
y x, y x
. , ( y , x)
.
- +.
x y NaN - NaN.
y> 0, x +0 -
http://javascript.ru/ecma[14.03.09 12:52:12]

+/2.
y> 0, x -0 -
+/2.
y +0, x> 0 - +0.
y +0 x +0 - +0.
y +0, x -0 -
+.
y +0, x <0 -
+.
y -0, x >0 - -0.
y -0 x +0 - -0.
y -0 x -0 -
-.
y -0, x<0 - .
y <0, x +0 -
-/2.
y <0, x -0 - /2.
y >0, y , x + - +0.
y> 0, y - , x - -
+.
y< 0, y - , x + - -0.
y <0, y - , x - -
-.
y +, x -
+/2.
If y -, x -
-/2.
y + x + -
+/4.
y + x - -
+3/4.
y - x + -
-/4.
y - x - -
-3/4.
15.8.2.6 ceil(x)
( -) , x
. x - x.

x
x
x
x
x
x

NaN - NaN.
+0 - +0.
-0 - -0.
+ - +.
- - -.
0, -1 - -0.

Math.ceil(x) -Math.floor(-x).
http://javascript.ru/ecma[14.03.09 12:52:12]

15.8.2.7 cos(x)
x.
.

x
x
x
x
x

NaN - NaN.
+0 - 1.
-0 - 1.
+ - NaN.
- - NaN.

15.8.2.8 exp(x)
x (e x, e ).

x
x
x
x
x

NaN - NaN.
+0 - 1.
-0 - 1.
+ - +.
- - +0.

15.8.2.9 floor(x)
( +) , x
. x - x.

x
x
x
x
x
x

NaN - NaN.
+0 - +0.
-0 - -0.
+ - +.
- - -.
0, -1 - +0.

Math.floor(x)

-Math.ceil(-x) .

15.8.2.10 log(x)
x.

x
x
x
x
x

NaN - NaN.
0 - NaN.
+0 -0 - -.
1 - +0.
+ - +.

15.8.2.11 max([ value1 [, value2 [,...]]])


, ToNumber
, .
, -.
http://javascript.ru/ecma[14.03.09 12:52:12]

NaN - NaN.

11.8.5, , +0 , 0.
length max 2.
15.8.2.12 min([ value1 [, value2 [,...]]])
, ToNumber
, .
, +.
NaN - NaN.

11.8.5, , +0 , 0.
length min 2.
15.8.2.13 pow(x, y)
x, y .
y NaN - NaN.
y +0 - 1, x NaN.
y -0 - 1, x NaN.
x NaN, y - NaN.
abs( x)>1, y + - + .
abs( x)>1, y - - +0.
abs( x)==1, y + - NaN .
abs( x)==1, y - - NaN .
abs( x)<1, y + - +0.
abs( x)<1, y - - +.
x +, y >0 - + .
x +, y <0 - +0 .
x -, y >0 y - , - .
x -, y >0 y , + .
x -, y <0 y - , -0 .
x -, y <0 y , +0 .
x +0, y >0 - +0 .
x +0, y >0 - + .
x -0, y >0 y - , -0 .
x -0, y >0 y , +0 .
x -0, y <0 y - , -.
x -0, y <0 y , + .
x<0, x - , y - y ,
NaN.
15.8.2.14 random()
, 0, 1,
http://javascript.ru/ecma[14.03.09 12:52:12]



. .
15.8.2.15 round(x)
, x .
x -
, +. x - , x.

x
x
x
x
x
x
x

NaN - NaN.
+0 - +0.
-0 - -0.
+ - + .
- - -.
0, 0.5 , +0.
0, -0.5 - -0.

1
Math.round(3.5) 4, Math.round(-3.5) -3 .
2
Math.round(x) Math.floor(x+0.5), ,
x -0 0, -0.5 . Math.round(x)
-0, Math.floor(x+0.5) +0.
15.8.2.16 sin(x)
x. .

x
x
x
x

NaN - NaN.
+0 - +0.
-0 - -0.
+ - - NaN.

15.8.2.17 sqrt(x)
x.

x
x
x
x
x

NaN - NaN.
0 - NaN.
+0 - +0.
-0 - -0.
+ - + .

15.8.2.18 tan(x)
x.
.
x NaN - NaN.
x +0 - +0.
x -0 - -0.
http://javascript.ru/ecma[14.03.09 12:52:12]

x + - - NaN.
15.9 Date
15.9.1 Date
Date ,
. NaN. , Date
.
.
, , NaN,
NaN.
15.9.1.1
ECMAScript 1 1970 UTC
( - .. ).
. , 86,400,000
. ECMAScript -9
007 199 254 740 991 9 007 199 254 740 991.
285
616 1 1970 .
,
ECMAScript Date, : -100 000 000 +100
000 000 1 1970 UTC.
8 640 000 000 000 000 1 1970
UTC.
1 1970 UTC
+0.
15.9.1.2
t
( t) = floor(t /)
(86400000).
: (t)= t modulo
15.9.1.3
ECMAScript ,
.
, , ( 4) ((
100) ( 400)). , y
:
(y) = 365
= 366 (y
= 365 (y
= 366 (y

(y modulo 4) != 0
modulo 4) = 0 (y modulo 100) != 0
modulo 100) = 0 (y modulo 400) != 0
modulo 400) = 0

http://javascript.ru/ecma[14.03.09 12:52:12]

365 .
.
y :
(y) = 365 * (y-1970) + floor((y-1969)/4) floor((y-1901)/100) + floor((y1601)/400)
:
(y)= (y )
:
(t) = y ( )
, (y ) t
1 , , 0
:
(t)
= 0 ((t)) = 365
= 1 ((t)) = 366

15.9.1.4
0 11 .
(t) t
:
(t) = 0 0 <= (t)< 31
= 1 31
<= (t) < 59+(t)
= 2 59+(t) <= (t) < 90+(t)
= 3 90+(t) <= (t) < 120+(t)
= 4 120+(t) <= (t) < 151+(t)
= 5 151+(t) <= (t) < 181+(t)
= 6 181+(t) <= (t) < 212+(t)
= 7 212+(t) <= (t) < 243+(t)
= 8 243+(t) <= (t) < 273+(t)
= 9 273+(t) <= (t) < 304+(t)
= 10 304+(t) <= (t) < 334+(t)
= 11 334+(t) <= (t) < 365+(t)

(t)= ( t)-(( t))


, 0, ; 1 - ; 2 - ; 3 - ; 4 ; 5 - ; 6 - ; 7 - ; 8 - ; 9 - ; 10 - ; 11 - .
, (0) 0, 1
1970 .
15.9.1.5
1 31 .
(t) t :
(t)
= (t)+ 1 (t)= 0
= (t)-30 (t)= 1
= (t)-58-(t) (t)= 2
= (t)-89-(t) (t)= 3
http://javascript.ru/ecma[14.03.09 12:52:12]

=
=
=
=
=
=
=
=

(t)-119-(t)
(t)-150-(t)
(t)-180-(t)
(t)-211-(t)
(t)-242-(t)
(t)-272-(t)
(t)-303-(t)
(t)-333-(t)

(t)=
(t)=
(t)=
(t)=
(t)=
(t)=
(t)=
(t)=

4
5
6
7
8
9
10
11

15.9.1.6
t
( t)=( ( t) + 4) modulo 7
, 0, ; 1 - ; 2 - ; 3 ; 4 - ; 5 - ; 6 - . , (0)
4, 1 1970 .
15.9.1.8
, ECMAScript .
- LocalTZA, , ,
UTC, () .
LocalTZA. LocalTZA ,
.
15.9.1.9
, ECMAScript .
(t),
, :
(1)

t - (( t))
(2) t
( t)
(3)
((( t))
(4)
ECMAScript ,
. ,
.
, ,
.
,
ECMAScript
( ),
.
http://javascript.ru/ecma[14.03.09 12:52:12]

,
.
15.9.1.9b
UTC :
(t)= t + LocalTZA + (t)
UTC :
UTC( t) = t - LocalTZA - (t - LocalTZA)
, UTC(( t)) t.
15.9.1.10 , ,
:
( t) = floor(t / ) modulo
( t) = floor(t / ) modulo
( t) = floor(t / ) modulo
(t)= t modulo
= 24
= 60
= 60
= 1000
= * = 60000
= * = 3600000
15.9.1.11 (hour, min, sec, ms)
,
ECMAScript.
:
1. hour , min , sec , ms NaN.
2. ToInteger( hour ).
3. ToInteger( min ).
4. ToInteger( sec ).
5. ToInteger( ms ).
http://javascript.ru/ecma[14.03.09 12:52:12]

6. (2) * + (3) * + (4) *


+ (5), IEEE
754 (. . ECMAScript * +).
7. (6).
15.9.1.12 (year, month, date)
,
ECMAScript.
:
1. year , month , date - NaN.
2. ToInteger( year).
3. ToInteger( month).
4. ToInteger( date).
5. (2) + floor((3)/ 12).
6. (3) modulo 12.
7. t , (t) == (5), (t) ==
(6), (t) == 1; ( -
), NaN.
8. ((7)) + (4)-1.
9. (8).
15.9.1.13 (day, time)
,
ECMAScript.
:
1. day time - NaN.
2. day * + time .
3. (2).
15.9.1.14 (time)
,
ECMAScript.
:
1. time - NaN.
2. abs((1)) > 8.64 x 10 15 - NaN.
http://javascript.ru/ecma[14.03.09 12:52:12]

3.
,

,
ToInteger(
(2)),

ToInteger((2)) + (+ 0). ( -0 +0.)

3 ,
. , 64-
64- .
-0 +0.
15.9.2 Date
Date , , ,
(UTC).

Date(...)
.

new Date(...)

15.9.2.1 Date([ year [, month[, date[, hours [, minutes[, seconds[, ms]]]]]]])


. ,
. ,
(new Date()).toString() .
15.9.3 Date
Date new , , ..
.
15.9.3.1 new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])
Date 2 7,
year, month () date, hours, minutes, seconds
ms .
[[Prototype]]
- Date, .. ,
Date.prototype (. 15.9.4.1).
[[Class]] "Date".
[[Value]] :
1. ToNumber( year).
2. ToNumber( month).
3. date, ToNumber( date), 1.
4. hours , ToNumber( hours ), 0.
5. minutes , ToNumber( minutes ), 0.
6. seconds , ToNumber( seconds ), 0.
http://javascript.ru/ecma[14.03.09 12:52:12]

7. ms , ToNumber( ms ), 0.
8. (1) NaN 0 <= ToInteger((1)) < 99, (8)
1900 + ToInteger((1)). (8) (1).
9. ((8), (2), (3)).
10. ((4), (5), (6), (7)).
11. ((9), (10)).
12.

(UTC((11))).

[[Value]]

15.9.3.2 new Date(value)


[[Prototype]]
- Date, .. ,
Date.prototype (. 15.9.4.1).
[[Class]] "Date".
[[Value]] :
1. ToPrimitive( value).
2. ((1)) String - 5.
3. V ToNumber((1)).
[[Value]]
4.

(V ) .

5. (1) , , parse (.
15.9.4.2). V - .
6. 4.
15.9.3.3 new Date()
[[Prototype]]
- Date, .. ,
Date.prototype (. 15.9.4.1).
[[Class]] "Date".
[[Value]]
( UTC).
15.9.4 Object
[[Prototype]] Date Function (. 15.3.4).
http://javascript.ru/ecma[14.03.09 12:52:12]

length ( 7),
Date :
15.9.4.1 Date.prototype
Date.prototype - Date (.
15.9.5).
{ DontEnum, DontDelete, ReadOnly }.
15.9.4.2 Date.parse(string)
parse ToString
. - UTC,
. ,
UTC - ,
.
x - Date,
ECMAScript,
,
:
x. valueOf()
Date.parse(x. toString())
Date.parse(x.toUTCString())


Date.parse(x. toLocaleString())

, .
, , Date.parse ,
,
toString toUTCString.
15.9.4.3 Date.UTC(year, month[, date[, hours [, minutes[, seconds[, ms]]]]])
UTC ,
. UTC 2 7,
year, month () date, hours, minutes,
seconds ms . :
1. ToNumber( year).
2. ToNumber( month).
3. date, ToNumber( date), 1.
4. hours , ToNumber( hours ), 0.
5. minutes , ToNumber( minutes ), 0.
http://javascript.ru/ecma[14.03.09 12:52:12]

6. seconds , ToNumber( seconds ), 0.


7. ms , ToNumber( ms ), 0.
8. (1) NaN 0 <= ToInteger((1)) < 99, (8)
1900 + ToInteger((1)). (8) (1).
9. ((8), (2), (3)).
10. ((4), (5), (6), (7)).
11. ((9), (10)).
length UTC 7.

UTC Date :
Date,
UTC, .
15.9.5 - Date
- Date Date ( [[Class]] "Date"),
NaN.
[[Prototype]] - Date Object (15.2.3.1).
, - Date,
" Date" this,
. :
this , [[Class]]
"Date", TypeError. " "
, Date, ..
[[Value]] Date.
15.9.5.1 Date.prototype.constructor
Date.prototype.constructor Date .
15.9.5.2 Date.prototype.toString()
.
, Date
.

Date d,
Date.prototype.parse(d.toString()) (. 15.9.4.2) d.

15.9.5.3 Date.prototype.toDateString()

http://javascript.ru/ecma[14.03.09 12:52:12]

, Date,
, .
15.9.5.4 Date.prototype.toTimeString()
.
, Date,
,
15.9.5.5 Date.prototype.toLocaleString()
.
, Date
,
.

, ,
.
- .
15.9.5.6 Date.prototype.toLocaleDateString()
.
, Date,
, ,
.

, ,
.
- .
15.9.5.7 Date.prototype.toLocaleTimeString()
.
, Date,
, ,
.

, ,
.
- .
15.9.5.8 Date.prototype.valueOf()
valueOf , .
15.9.5.9 Date.prototype.getTime()
1. this , [[Class]] "Date" TypeError.
http://javascript.ru/ecma[14.03.09 12:52:12]

2. .
15.9.5.10 Date.prototype.getFullYear()
1. t - .
2. t NaN - NaN.
3. (( t)).
15.9.5.11 Date.prototype.getUTCFullYear()
1. t - .
2. t NaN - NaN.
3. (t).
15.9.5.12 Date.prototype.getMonth()
1. t - .
2. t NaN - NaN.
3. (( t)).
15.9.5.13 Date.prototype.getUTCMonth()
1. t - .
2. t NaN - NaN.
3. (t).
15.9.5.14 Date.prototype.getDate()
1. t - .
2. t NaN - NaN.
3. (( t)).
15.9.5.15 Date.prototype.getUTCDate()
1. t - .
2. t NaN - NaN.
3. ( t).
15.9.5.16 Date.prototype.getDay()
1. t - .
2. t NaN - NaN.
http://javascript.ru/ecma[14.03.09 12:52:12]

3. Return (( t)).
15.9.5.17 Date.prototype.getUTCDay()
1. t - .
2. t NaN - NaN.
3. ( t).
15.9.5.18 Date.prototype.getHours()
1. t - .
2. t NaN - NaN.
3. ((t)).
15.9.5.19 Date.prototype.getUTCHours()
1. t - .
2. t NaN - NaN.
3. ( t).
15.9.5.20 Date.prototype.getMinutes()
1. t - .
2. t NaN - NaN.
3. ((t)).
15.9.5.21 Date.prototype.getUTCMinutes()
1. t - .
2. t NaN - NaN.
3. (t).
15.9.5.22 Date.prototype.getSeconds()
1. t - .
2. t NaN - NaN.
3. ((t)).
15.9.5.23 Date.prototype.getUTCSeconds()
1. t - .

http://javascript.ru/ecma[14.03.09 12:52:12]

2. t NaN - NaN.
3. (t).
15.9.5.24 Date.prototype.getMilliseconds()
1. t - .
2. t NaN - NaN.
3. ((t)).
15.9.5.25 Date.prototype.getUTCMilliseconds()
1. t - .
2. t NaN - NaN.
3. (t).
15.9.5.26 Date.prototype.getTimezoneOffset()
UTC .
1. t - .
2. t NaN - NaN.
3. (t - (t)) / .
15.9.5.27 Date.prototype.setTime(time)
1. this - Date, TypeError.
2. ToNumber( time ).
3. ((1)).
4. [[Value]] this (2).
5. [[Value]] this.
15.9.5.28 Date.prototype.setMilliseconds(ms)
1. t - ( ).
2. ToNumber( ms ).
3.

(( t),
( t), (2)).

( t),

4. UTC(((t), (3))).
5. [[Value]] this ((4)).

http://javascript.ru/ecma[14.03.09 12:52:12]

6. [[Value]] this.
15.9.5.29 Date.prototype.setUTCMilliseconds(ms)
1. t - .
2. ToNumber( ms ).
3.

(( t),
( t), (2)).

( t),

4. (( t), (3)).
5. [[Value]] this ((4)).
6. [[Value]] this.
15.9.5.30 Date.prototype.setSeconds(sec [, ms ] )
ms , , ms
getMilliseconds().
1. t - ( ).
2. ToNumber( sec ).
3. ms - (t). ToNumber( ms ).
4.
(3)).

(( t),

( t),

(2),

5. UTC(((t), (4))).
6. [[Value]] this ((5)).
7. [[Value]] this.
length setSeconds 2.
15.9.5.31 Date.prototype.setUTCSeconds(sec [, ms ] )
ms , , ms
getUTCMilliseconds().
1. t - .
2. ToNumber( sec ).
3. ms - (t). ToNumber( ms ).
4.
(3)).

(( t),

5. (( t), (4)).
http://javascript.ru/ecma[14.03.09 12:52:12]

( t),

(2),

6. [[Value]] this ((5)).


7. [[Value]] this.
length setUTCSeconds 2.
15.9.5.33 Date.prototype.setMinutes(min [, sec [, ms ] ] )
sec , , sec
getSeconds().
ms , , ms
getMilliseconds().
1. t - ( ).
2. ToNumber( min ).
3. sec - (t). ToNumber( sec ).
4. ms - (t). ToNumber( ms ).
5. (( t), (2), (3), (4)).
6. UTC(((t), (5))).
7. [[Value]] this ((6)).
8. [[Value]] this.
length setMinutes 3.
15.9.5.34 Date.prototype.setUTCMinutes(min [, sec [, ms ] ] )
sec , , sec
getUTCSeconds().
ms , , ms
getUTCMilliseconds().
1. t - .
2. ToNumber( min ).
3. sec - (t). ToNumber( sec ).
4. ms - (t). ToNumber( ms ).
5. (( t), (2), (3), (4)).
6. (( t), (5)).
7. [[Value]] this ((6)).
8. [[Value]] this.
http://javascript.ru/ecma[14.03.09 12:52:12]

length setUTCMinutes 3.
15.9.5.35 Date.prototype.setHours(hour[, min [, sec[, ms]]])
min , , min
getMinutes().
sec , , sec
getSeconds(). ms , ,
ms getMilliseconds().
1. t - ( ).
2. ToNumber( hour ).
3. min - (t). ToNumber( min ).
4. sec - (t). ToNumber( sec ).
5. ms - (t). ToNumber( ms ).
6. ((2), (3), (4), (5)).
7. UTC(((t), (6))).
8. [[Value]] this ((7)).
9. [[Value]] this.
length setHours 4.
15.9.5.36 Date.prototype.setUTCHours(hour [, min[, sec [, ms ]]])
min , , min
getUTCMinutes().
sec , , sec
getUTCSeconds(). ms , ,
ms getUTCMilliseconds().
1. t - .
2. ToNumber( hour ).
3. min - (t). ToNumber( min ).
4. sec - (t). ToNumber( sec ).
5. ms - (t). ToNumber( ms ).
6. ((2), (3), (4), (5)).
7. (( t), (6)).

http://javascript.ru/ecma[14.03.09 12:52:12]

8. [[Value]] this ((7)).


9. [[Value]] this.
length setUTCHours 4.
15.9.5.36 Date.prototype.setDate(date)
1. t - ( ).
2. ToNumber( date).
3. (( t), (t), (2)).
4. UTC(((3), (t))).
5. [[Value]] this ((4)).
6. [[Value]] this.
15.9.5.37 Date.prototype.setUTCDate(date)
1. t - .
2. ToNumber( date).
3. (( t), (t), (2)).
4. ((3), (t)).
5. [[Value]] this ((4)).
6. [[Value]] this.
15.9.5.38 Date.prototype.setMonth(month [, date ] )
date , , date
getDate().
1. t - ( ).
2. ToNumber( month).
3. date - ( t). ToNumber( date).
4. (( t), (2), (3)).
5. UTC(((4), (t))).
6. [[Value]] this ((5)).
7. [[Value]] this.
length setMonth 2.

http://javascript.ru/ecma[14.03.09 12:52:12]

15.9.5.39 Date.prototype.setUTCMonth(month [, date ] )


date , , date
getUTCDate().
1. t - .
2. ToNumber( month).
3. date - ( t). ToNumber( date).
4. (( t), (2), (3)).
5. ((4), (t)).
6. [[Value]] this ((5)).
7. [[Value]] this.
length setUTCMonth 2.
15.9.5.40 Date.prototype.setFullYear(year [, month [, date ] ] )
month , , month
getMonth().
date , , date
getDate().
1. t - ( ).
NaN, t +0.
2. ToNumber( year).
3. month
ToNumber( month).

(t).

4. date - ( t). ToNumber( date).


5. ((2), (3), (4)).
6. UTC(((5), (t))).
7. [[Value]] this ((6)).
8. [[Value]] this.
length setFullYear 3.
15.9.5.41 Date.prototype.setUTCFullYear(year [, month [, date ] ] )
month , , month
getUTCMonth().
date , , date
http://javascript.ru/ecma[14.03.09 12:52:12]

getUTCDate().
1. t - . NaN,
t +0.
2. ToNumber( year).
3. month
ToNumber( month).

(t).

4. date - ( t). ToNumber( date).


5. ((2), (3), (4)).
6. ((5), (t)).
7. [[Value]] this ((6)).
8. [[Value]] this.
length setUTCFullYear 3.
15.9.5.42 Date.prototype.toUTCString()
.
, Date UTC
.
15.9.6 Date
Date , ,
- Date.
15.10 RegExp ( )
RegExp .


Perl 5 .
15.10.1
RegExp - .
, .

::

::

http://javascript.ru/ecma[14.03.09 12:52:12]

::
[]

::

::
^
$
\b
\B

::

::
*
+
?
{
{
{

}
,}
, }

::

.
\

Escape

( )
(?:
(?=
(?!

)
)
)

::
:

^ $ \ . * + ? ( ) [ ] { } |

Escape ::
Escape
Escape
Escape
Escape ::
Escape
c
Escape
Escape
Escape
http://javascript.ru/ecma[14.03.09 12:52:12]

Escape ::
f n r t v

::

a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Escape ::

Escape ::
[

Escape ::
d D s S w W

::
[ [ {^}]
[^ ]

::
[]

::


-
::


-
::

::

\ Escape

\ ] -

Escape ::
Escape
b

Escape
Escape
15.10.2
,
. ,
, , ,
.
http://javascript.ru/ecma[14.03.09 12:52:12]

15.10.2.1
:

Input - , .
input[n] n- input, n 0
() InputLength ( ).
InputLength - Input.
NCapturingParens - (. .
,
:: ( )) .
- (, (
:: ( ).
IgnoreCase - ignoreCase (" ")
RegExp.
Multiline - multiline ("") RegExp.
,
:

- .
- (endIndex, captures), endIndex - integer,
captures - NCapturingParens .

. endIndex
,
, captures . n captures , ,
n- , undefined, n-
.
,
.
MatchResult ,
failure, , .
(. .
, ),
State
MatchResult. ,
, , ,
.
(
) ,
, State.
, State,
. , failure.
,
( ) MatchResult.
(
) ,
, .
,
http://javascript.ru/ecma[14.03.09 12:52:12]

.
, ,
, .
, , .

, ,
, .
,
.
(
) true,
, false, .
Escape , . Escape
Escape escape-:
ch , escape- ch ,
n , escape-
n- .
15.10.2.2
:: :
1. , m.
2. , : str
index , :
1. Input - str.
15.10.2.
2. InputLength - Input.
15.10.2.
3. c - ,
MatchResult.
4. cap - NCapturingParens
1 NCapturingParens .

undefined,

5. x - (index, cap ).
6. m(x, c) .
: ("")
. RegExp.prototype.exec
, , ,
, , ,
. 15.10.2 ,
SyntaxError. ,
,
(
, - ,
http://javascript.ru/ecma[14.03.09 12:52:12]

).
15.10.2.3
::
, , .
:: |
:
1. , m1 .
2. , m2 .
3. -,
x c - :

1. m1(x, c) , r.
2. r failure, r.
3. m2(x, c) .
: |
. (
). ,
(
). , ,
,
. ,
.
, |,
undefined. , ,
/a|ab/.exec("abc")

"a" , "ab" . ,
/((a)|(ab))((c)|(bc))/.exec("abc")


["abc", "a", "a", undefined, "bc", undefined, "bc"]


["abc", "ab", undefined, "ab", "c", "c", undefined]

15.10.2.4
Alternative :: [empty] ,
: x c ,
c(x) .

http://javascript.ru/ecma[14.03.09 12:52:12]

::
:
1. , m1 .
2. , m2 .
3. -,
x c - :

1. d , - y
m2(y, c) .
2. m1(x, d) .

.
, ,
,
,
.
15.10.2.5
::
-, : x c ,
:
1. , t.
2. t(x) , r.
3. r false - failure.
4. c(x) .
:: ,
, .
::
:
1. , m.
2. , : min , (
) max greedy.
3. max min - SyntaxError.
4. parenIndex - ,
,
. , :: (
) , ,
:: ( ) .
http://javascript.ru/ecma[14.03.09 12:52:12]

5. parenCount -
. , :: ( )
.
6. -,
x c - :

1. (m, min, max, greedy, x, c, parenIndex, parenCount)


.
:
m, min , ( ) max, greedy, x,
c , parenIndex parenCount -
:
1. max - c(x) .
2. - d ,
- y , :
1. min , endIndex y endIndex x - failure.
2. min , min2 . min2
min -1.
3. max , max2 ; max2
max-1.
4. (m, min2, max2, greedy, x, c, parenIndex, parenCount)
.
3. cap - captures x.
4. k , parenIndex < k k <=
parenIndex+ parenCount , cap[ k ] undefined.
5. e endIndex x.
6. xr - (e, cap ).
7. min - m(xr, d) .
8. greedy true - 12.
9. c(x) z .
10. z failure - z.
11. m(xr, d) .
12. m(xr, d) z .
13. z failure - z.
http://javascript.ru/ecma[14.03.09 12:52:12]

14. c(x) .
: ,
, . "" ("non-greedy") -
, .
"" ("greedy"), Atom
,
. Atom, ,
.
Atom ,
(, -, )
.
. (n-)

((n-1)-) . ,
.
( , )
(n-1)- ..
,
/a[a-z]{2,4}/.exec("abcdefghi")

"abcde"
/a[a-z]{2,4}?/.exec("abcdefghi")

"abc".

/(aa|aabaac|ba|b|c)*/.exec("aabaac")

, ,

["aaba", "ba"]

- :
["aabaac", "aabaac"] ["aabaac", "c"]


,
( ). 10 15:
"aaaaaaaaaa, aaaaaaaaaaaaaaa".replace(/^(a+)\1*,\1+$/,"$1")

: "aaaaa".
4 ,
http://javascript.ru/ecma[14.03.09 12:52:12]

/(z)((a+)?(b+)?(c))*/.exec("zaacbbbcac")


["zaacbbbcac", "z", "ac", "a", undefined, "c"]


["zaacbbbcac", "z", "ac", "a", "bbb", "c"]

* ,
,
2, 3 4.
1 d ,
, ,
, .

, :
/(a*)*/.exec("b")

:
/(a*)b\1+/.exec("baaaac")


["b", ""]

15.10.2.6
Assertion :: ^ , - x,
:
1. e endIndex x.
2. e - true.
3. Multiline false - false.
4. Input[ e-1] - <LF>, <CR>, <LS> <PS> -
true.
5. false.
Assertion :: $ , - x,
:

http://javascript.ru/ecma[14.03.09 12:52:12]

1. e endIndex x.
2. e InputLength - true.
3. multiline false - false.
4. Input[ e] - <LF>, <CR>, <LS> <PS> -
true.
5. false.
Assertion :: \b
-, x, :
1. e endIndex x.
2. ( e-1), a.
3. ( e), b .
4. a true, b false - true.
5. a false, b true - true.
6. false.
Assertion :: \B
-, x, :
1. e endIndex x.
2. ( e-1), a.
3. ( e), b.
4. a true, b false - false.
5. a false, b true - false.
6. true.

e :

1. e == -1 e == InputLength - false.
2. c - Input[e].
3. c - ,
true.
a b c d e f g h i j k l m n o p q r s t u v w x y z

http://javascript.ru/ecma[14.03.09 12:52:12]

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 _

4. false.
15.10.2.7
::
:
1. , : min
( ) max.
2. : min , max true.
:: ?
:
1. , : min
( ) max.
2. : min , max false.
:: * 0 .
:: + 1 .
:: ? 0 1.
:: { }
:
1. i (. 7.8.3).
2. : i i.
:: { ,}
:
1. i .
2. i .


} :

::

1. i - .
2. j - .
3. : i j.
15.10.2.8
:: :
http://javascript.ru/ecma[14.03.09 12:52:12]

1. ch - , .
2. A - , ch .
3. (A , false) .
:: . :
1. A - <LF>, <CR>, <LS> <PS>.
2. (A , false) .
:: \ Escape
Escape .
:: :
1. , A invert .
2. (A, invert) .
:: ( ) :
1. , m.
2. parenIndex - ,

. , :: (
) , ,
:: ( ) .
3. -,
x c - :

1. - d ,
- y , :
1. cap - captures y .
2. xe endIndex x.
3. ye endIndex y .
4. s - , Input xe
() ye ( ).
5. cap [ parenIndex+1] s .
6. z - (ye, cap ).
7. c(z) .
2. m(x, d) . :: (?:
http://javascript.ru/ecma[14.03.09 12:52:12]

)
.

:: (?= ) :
1. , m.
2. -,
x c - :

1. d - ,
MatchResult.
2. m(x, d) , r.
3. r failure - failure.
4. y r.
5. cap - captures y .
6. xe endIndex x.
7. z - (xe, cap ).
8. c(z) .
:: (?! ) :
1. , m.
2. -,
x c - :

1. d - ,
MatchResult.
2. m(x, d) , r.
3. r failure - failure.
4. c(x) .

: A invert -
:
1. -,
x c - :
1. e endIndex x.
2. e == InputLength - failure.

http://javascript.ru/ecma[14.03.09 12:52:12]

3. c - Input[e].
4. cc (c).
5. invert true - 8.
6. A a, (a)==
cc - failure.
7. 9.
8. A a, (a)== cc failure.
9. cap - captures x.
10. y - (e+1, cap ).
11. c(y) .
-
ch :
1. IgnoreCase false - ch.
2. u ch , ,
String.prototype.toUpperCase ch .
3. u - x.
4. cu - u.
5. ch 128, cu 128 ch .
6. cu .
: ( )
,
. ( "\",
), ,

.
, (?: ).
(?= ) .
,
,
.
, .
, (?=
( Perl).
, ,
http://javascript.ru/ecma[14.03.09 12:52:12]

.
,
/(?=(a+))/.exec("baaabac")

b , ,
:
["", "aaa"]

, :
/(?=(a+))a*b\1/.exec("baaabac")


["aba", "a"]


["aaaba", "a"]

(?! ) .
,
.
.
,
.
undefined, ,
, . ,
/(.*?)a(?!(a+)b\2c)\2(.*)/.exec("baaabaac")

a,
n a, b, n a (
\2) c. \2
, undefined ,
, . :
["baaabaac", "ba", undefined, "abaac"]

- ,
.
, (,
"" (( u00DF) "SS"), .
,
ASCII, ASCII.
, , \u0131 \u017F
, /[a-z]/i ,
ASCII. , , /[^\W]/i
a, b,..., h, i s.

http://javascript.ru/ecma[14.03.09 12:52:12]

15.10.2.9 Escape
Escape :: Escape :
1. Escape, Escape E.
2. E - , 6.
3. ch - E.
4. A - , ch .
5. (A , false) .
6. E . n - .
7. n= 0 n> NCapturingParens - SyntaxError.
8. -,
x c - :

1. cap - captures x.
2. s cap[n] .
3. s undefined - c(x) .
4. e endIndex x.
5. len s .
6. f e + len .
7. f > InputLength - failure.
8. i 0 () len ( ) ,
(s[i])

(Input[e+i]), - failure.
9. y (f, cap ).
10. c(y) .
Escape :: Escape :
1. Escape , ch .
2. A - , ch .
3. (A , false) .
Escape :: Escape
:
1. Escape, A .
http://javascript.ru/ecma[14.03.09 12:52:12]

2. (A , false) .
: Escape- \,
n n-
(. 15.10.2.11). n
- . n
, n- undefined,
, .
15.10.2.10 Escape
Escape :: Escape
:
Escape
t

\u0009

\u000A

\u000B

\u000C

\u000D


( )


<HT>
<LF>
<VT>
<FF>
<CR>

Escape :: c
:
1. ch - , .
2. i - ch .
3. j - i 32.
4. j.

Escape
::

Escape
Escape (. 7.8.4)
.
Escape :: Escape
Escape (.
7.8.4) .
Escape :: Escape
, Escape .
15.10.2.11 Escape
Escape :: [
] :
1. i - .

http://javascript.ru/ecma[14.03.09 12:52:12]

2. i - Escape, <NUL> (
0000).
3. Escape, i.
" " 7.8.3.
: \ n,
0, escape- . n
. \0 NUL,
.
15.10.2.12 Escape
Escape :: d
, 0 9 .
Escape :: D
, , Escape :: d.
Escape :: s ,
, ( 7.2)
( 7.3).
Escape :: S
, , Escape :: s.
Escape :: w
, :
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 _

Escape :: W
, , Escape :: w.
15.10.2.13
{^}] ]
:: [ [

false.
:: [ [^ ]

true.
15.10.2.14
:: []
.

http://javascript.ru/ecma[14.03.09 12:52:12]

::

.
15.10.2.15
::
.

::

1. , A .
2. , B .
3. A B .

:

::

1. , A .
2. , B .
3. , C .
4. (A, B) , D.
5. D C .
A B
:
1. A , B
- SyntaxError.
2. a - A .
3. b - B .
4. i - a.
5. j - b .
6. I > j - SyntaxError.
7. , i j .
15.10.2.16
::
.

http://javascript.ru/ecma[14.03.09 12:52:12]

::

:
1. , A .
2. , B .
3. A B .
::
:

1. , A .
2. , B .
3. , C .
4. (A, B) , D.
5. D C .
:
/ , .

.
(, \w)
.
,
, .
, , /[E-F]/ i E, F, e f,
/[E-f]/ i ASCII ,
[, \, ], ^, _ `.
- .
, ,

.
15.10.2.17
:: - ,
-.
::
.
15.10.2.18
:: \ ] ,
.
http://javascript.ru/ecma[14.03.09 12:52:12]

:: \ Escape
Escape .

15.10.2.19 Escape
Escape :: Escape
:
1. Escape, Escape E.
2. E - SyntaxError.
3. ch - E.
4. , ch .
Escape :: b ,
<BS> ( 0008).
Escape :: Escape
Escape ,

,
.
Escape :: Escape
Escape .
: escape, , \b,
\B . \b backspace, \B
.
.
15.10.3 RegExp
15.10.3.1 RegExp(pattern, flags)
pattern R , [[Class]] "RegExp" ,
flags undefined - R . RegExp (.
15.10.4.1), pattern flags , ,
.
15.10.4 RegExp
RegExp new , , ..
.
15.10.4.1 new RegExp(pattern, flags)
pattern R , [[Class]] "RegExp" ,
flags undefined, P pattern , R , F flags, R . pattern R ,
[[Class]] "RegExp" , flags undefined -
TypeError. P , pattern
undefined, ToString( pattern ) , F - , flags
http://javascript.ru/ecma[14.03.09 12:52:12]

undefined, ToString( flags ) .


global Boolean,
true, F "g" , false .
ignoreCase Boolean,
true, F "i" , false .
multiline Boolean,
true, F "m" , false .
F - , "g", "i" "m" ,
- SyntaxError.
P - SyntaxError.
[[Match]],
("") . ,
SyntaxError. (: pattern ,
escape- ,
RegExp. pattern escape-,
RegExp, "\" ,
.)
source
, P.
lastIndex 0.
[[Prototype]]
- RegExp, .. ,
RegExp.prototype.
[[Class]] "RegExp" .
15.10.5 RegExp
[[Prototype]] RegExp Function (. 15.3.4).
length ( 2),
RegExp :
15.10.5.1 RegExp.prototype
RegExp.prototype - RegExp (.
15.10.6).
{ DontEnum, DontDelete, ReadOnly }.
15.10.6 - RegExp
[[Prototype]] - RegExp
- Object . [[Class]] -
http://javascript.ru/ecma[14.03.09 12:52:12]

RegExp "Object".
- RegExp valueOf,
valueOf - Object.
, - RegExp,
" RegExp" this,
. this ,
[[Class]] "RegExp" , TypeError.
15.10.6.1 RegExp.prototype.constructor
RegExp.prototype.constructor
RegExp.

15.10.6.2 RegExp.prototype.exec(string)
string
Array, , null,
.
ToString( string )
:
1. S - ToString( string ).
2. length - S.
3. lastIndex - lastIndex property.
4. i - ToInteger( lastIndex).
5. global false - i =0.
6. i <0 i > length , lastIndex 0 null .
7. [[Match]], S i. [[Match]] failure -
8. r 10.
8. i = i + 1.
9. 6.
10. e - endIndex r.
11. global true - lastIndex e.
12. n - captures r. ( ,
NCapturingParens 15.10.2.1.)
13. :
index S,
-.
http://javascript.ru/ecma[14.03.09 12:52:12]

input S.
length n +1.
0 - (. . S i
e ).
i, , i >0 i <= n, - ToString( i)
i- captures r.
15.10.6.3 RegExp.prototype.test(string)
RegExp.prototype.exec(string) != null .
15.10.6.4 RegExp.prototype.toString()
src - , . src
source ,
RegExp. src RegExp
-
.
, "/", src
"/", "g" , global true, "i" ,
ignoreCase true, "m" , multiline true.
toString

src
, RegExp,
src. , new RegExp("/"),
src "/" "\/" .

( "/\//")

toString

.
15.10.7 RegExp
RegExp , ,
[[Prototype]], :
15.10.7.1 source
source ,
. { DontEnum,
DontDelete, ReadOnly }.
15.10.7.2 global
global Boolean ,
"g" . { DontEnum, DontDelete, ReadOnly
}.
15.10.7.3 ignoreCase
ignoreCase Boolean ,
"i" . { DontEnum, DontDelete, ReadOnly
}.
http://javascript.ru/ecma[14.03.09 12:52:12]

15.10.7.4 multiline
multiline Boolean ,
"m" . { DontEnum, DontDelete, ReadOnly
}.
15.10.7.5 lastIndex
lastIndex , ,
. {
DontEnum, DontDelete }.
15.11 Error
Error ("") ,
. Error
-.
15.11.1 Error
Error , ,
Error. , Error(...)
new Error(...) , .
15.11.1.1 Error (message)
[[Prototype]]
- Error, .. ,
Error.prototype (. 15.11.3.1).
[[Class]] "Error".
message undefined, message
ToString( message).
15.11.2 Error
Error new , , ..
.
15.11.2.1 new Error (message)
[[Prototype]]
- Error, .. ,
Error.prototype (. 15.11.3.1).
[[Class]] Error "Error".
message undefined, message
ToString( message).
15.11.3 Error

http://javascript.ru/ecma[14.03.09 12:52:12]

[[Prototype]] Error Function (. 15.3.4).


length ( 1),
Error :
15.11.3.1 Error.prototype
Error.prototype
15.11.4).

Error

(.

{ DontEnum, DontDelete, ReadOnly }.


15.11.4 - Error
- Error Error ( [[Class]] "Error").
[[Prototype]] - Error Object (15.2.3.1).
15.11.4.1 Error.prototype.constructor
Error.prototype.constructor Error .
15.11.4.2 Error.prototype.name
Error.prototype.name "Error".
15.11.4.3 Error.prototype.message
Error.prototype.message
.
15.11.4.4 Error.prototype.toString ()
.
15.11.5 Error
Error , ,
- Error.
15.11.6 ,
NativeError ,
. ,
15.11.7.
15.11.6.1 EvalError
, eval
. . 15.1.2.1.
15.11.6.2 RangeError
http://javascript.ru/ecma[14.03.09 12:52:12]

, . .
15.4.2.2, 15.4.5.1, 15.7.4.5, 15.7.4.6 15.7.4.7.
15.11.6.3 ReferenceError
, . . 8.7.1
8.7.2.
15.11.6.4 SyntaxError
(). . 15.1.2.1, 15.3.2.1,
15.10.2.5, 15.10.2.9, 15.10.2.15, 15.10.2.19 15.10.4.1.
15.11.6.5 TypeError
, . .
8.6.2, 8.6.2.6, 9.9, 11.2.2, 11.2.3, 11.8.6, 11.8.7, 15.3.4.2, 15.3.4.3, 15.3.4.4, 15.3.5.3,
15.4.4.2, 15.4.4.3, 15.5.4.2, 15.5.4.3, 15.6.4, 15.6.4.2, 15.6.4.3, 15.7.4, 15.7.4.2,
15.7.4.4, 15.9.5, 15.9.5.9, 15.9.5.27, 15.10.4.1 15.10.6.
15.1.6.6 URIError
, , URI,
. . 15.1.3.
15.11.7 NativeError
ECMAScript ,
NativeError, 15.11.6.
,
NativeError,
name - message
-.
NativeError
- 15.11.6.
15.11.7.1 NativeError Constructors Called as Functions
NativeError , ,
. ,
.
15.11.7.2 NativeError (message)
[[Prototype]] -
. [[Class]]
"Error".
message undefined, message
ToString( message).
15.11.7.3 NativeError
http://javascript.ru/ecma[14.03.09 12:52:12]

NativeError new ,
, .. .
15.11.7.4 New NativeError (message)
[[Prototype]] -

NativeError.

[[Class]]

"Error".
message undefined, message
ToString( message).
15.11.7.5 NativeError
[[Prototype]] NativeError Function (. 15.3.4).
length ( 1),
NativeError :
15.11.7.6 NativeError. prototype
NativeError.prototype - NativeError (.
15.11.7.7). NativeError .
{ DontEnum, DontDelete, ReadOnly }.
15.11.7.7 - NativeError
- NativeError Error ( [[Class]]
"Error").

[[Prototype]] - NativeError
- Error (15.11.4).
15.11.7.8 NativeError.prototype.constructor
constructor -
NativeError - NativeError (15.11.7).

15.11.7.9 NativeError.prototype.name
name - NativeError
(, NativeError).
15.11.7.10 NativeError.prototype.message
name - NativeError
.

NativeError
- Error .
http://javascript.ru/ecma[14.03.09 12:52:12]

toString ,

15.11.7.11 NativeError
NativeError , ,
- Error.

16
,
.
,
.

eval- eval ,
.

, ,
:
return, break continue .
eval - , .
.
PutValue ,
(, 3=4 ).
,
,
.
,
.

:

.
, ( eval ,
Function
RegExp), SyntaxError,
, ,
SyntaxError,
.
, , ,
, .
(,
) ,
( ReferenceError).
EvalError.
EvalError,
http://javascript.ru/ecma[14.03.09 12:52:12]

/ eval .
toFixed, toExponential toPrecision
, RangeError, ,
fractionDigits precision .
eval

A
A
()

A.1
. 6
::
Unicode
. 7
::


. 7
::

. 7.2
::
<TAB>
<VT>
<FF>
<SP>
<NBSP>
<USP>
. 7.3
::
<LF>
<CR>
<LS>
<PS>
. 7.4
::

http://javascript.ru/ecma[14.03.09 12:52:12]


. 7.4
::
/* */
. 7.4
::

*
. 7.4
::

*
. 7.4
::
*
. 7.4
::
/ *
. 7.4
::
//
. 7.4
::

. 7.4
::

. 7.5
::

. 7.5.1
::

Null

http://javascript.ru/ecma[14.03.09 12:52:12]

. 7.5.2
::

break else new var case finally return void catch for switch while continue function
this with default if throw delete in try do instanceof typeof

. 7.5.3
::

abstract enum int short boolean export interface static byte extends long super char
final native synchronized class float package throws const goto private transient
debugger implements protected volatile double import public

. 7.6
::

. 7.6
::


. 7.6
::

$
_

\ Escape
. 7.6
::

\ Escape
. 7.6

: " (Lu)", "


(Ll)", " (Lt)", "- (Lm)", " (Lo)",
"- (Nl)".
. 7.6

: "- (Mn)"
" (Mc)"
. 7.6

" (Nd)"
. 7.6
http://javascript.ru/ecma[14.03.09 12:52:12]


" (Pc)"
. 7.6
::

0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F

. 7.7
::
{ } ( ) [ ]
. ; , < > <=
>= == != === !==
+ - * % ++ -<< >> >>> & | ^
! ~ && || ? :
= += -= *= %= <<=
>>= >>>= &= |= ^=

. 7.7
::
/
/=

. 7.8
::
Null

. 7.8.1
Null ::
null

. 7.8.2
::
true
false

. 7.8.3
::

. 7.8.3
::
.
.

. 7.8.3
::
http://javascript.ru/ecma[14.03.09 12:52:12]


. 7.8.3
::


. 7.8.3
::
0 1 2 3 4 5 6 7 8 9

. 7.8.3
::
e E

. 7.8.3
::

+
-
. 7.8.3
::
0x
0X

. 7.8.4
::
" "
' '
. 7.8.4
::

. 7.8.4
::

. 7.8.4
::
- " - \
\ Escape
. 7.8.4
SingleStringCharacter ::
- ' - \

\ Escape
http://javascript.ru/ecma[14.03.09 12:52:12]

. 7.8.4
Escape ::
Escape
0 [ ]
Escape
Escape
. 7.8.4
Escape ::
Escape
Escape
. 7.8.4
Escape ::
' " \ b f n r t v

. 7.8.4
Escape ::
Escape

x
u

. 7.8.4
Escape ::
x
. 7.8.4
Escape ::
u

. 7.8.5
::
/ /
. 7.8.5
::

. 7.8.5
::
[]

. 7.8.5
::
* \ /

. 7.8.5
::
http://javascript.ru/ecma[14.03.09 12:52:12]

\ /

. 7.8.5
::
\
. 7.8.5
::

. 7.8.5
::
[]

A.2
. 9.3.1
:::


. 9.3.1
:::

. 9.3.1
:::
<TAB>
<SP>
<NBSP>
<FF>
<VT>
<CR>
<LF>
<LS>
<PS>
<USP>
. 9.3.1
:::

. 9.3.1
:::

+
-
. 9.3.1
http://javascript.ru/ecma[14.03.09 12:52:12]

:::
Infinity

.
.

. 9.3.1
:::


. 9.3.1
:::
0 1 2 3 4 5 6 7 8 9

. 9.3.1
:::

. 9.3.1
:::
e E

. 9.3.1
:::

+
-
. 9.3.1
:::
0x
0X

. 9.3.1
:::

0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F

A.3
. 11.1
:
this

( )
. 11.1.4
:
http://javascript.ru/ecma[14.03.09 12:52:12]

[
[
[

]
]
,

. 11.1.4
:

,
. 11.1.4
:
,
,
. 11.1.5
:

{}
{ }

. 11.1.5
:
:
, :
. 11.1.5
:

. 11.2
:

[ ]
.
new
. 11.2
New :

new New
. 11.2
Call :

Call
Call [ ]
Call .
. 11.2
http://javascript.ru/ecma[14.03.09 12:52:12]

()
( )

. 11.2
:

,
. 11.2
:
New
Call
. 11.3
:

[ ] ++
[ ] -. 11.4
:

delete
void
typeof
++
--
+
-
~
!
. 11.5
:

*
/
%
. 11.6
:

+
-
. 11.7
:

<<
>>
>>>
http://javascript.ru/ecma[14.03.09 12:52:12]

. 11.8
:

<
>
<=
>=
instanceof
in

. 11.8
In :

In
In
In
In
In

<
>
<=
>=
instanceof

. 11.9
:

==
!=
===
!==
. 11.9
In :
In
In == In
In != In
In === In
In !== In
. 11.10
:

&
. 11.10
In :
In
In & In
. 11.10
:

^
. 11.10
http://javascript.ru/ecma[14.03.09 12:52:12]

In :
In
In

In

. 11.10
:

|
. 11.10
In :
In
In | In
. 11.11
:

&&
. 11.11
In :
In
In && In
. 11.11
:

||
. 11.11
In :
In
In || In
. 11.12
:

? :
. 11.12
In :
In
In ? In :
In
. 11.13
:


. 11.13
In :
http://javascript.ru/ecma[14.03.09 12:52:12]

In
In
. 11.13
:

= *= /= %= += -= <<= >>= >>>= &= ^= |=

. 11.14
:

,
. 11.14
In :
In
In , In
A.4
. 12
:

If

Continue
Break
Return
With

Switch
Throw
Try
. 12.1
:
{ }
. 12.1
:


. 12.2
:
var ;
. 12.2
:

http://javascript.ru/ecma[14.03.09 12:52:12]

. 12.2
In :
In
In , In
. 12.2
:

. 12.2
In :
In
. 12.2
:
=
. 12.2
In :
= In
. 12.3
:
;

. 12.4
:
[ { {, function }] ;
. 12.5
If :
if ( ) else
if ( )
. 12.6
:
do while ( );
while ( )
for (In ; ; )
for (var In; ; )

for ( in )
for (var In in )
. 12.7
Continue :
continue [ ] ;
. 12.8
http://javascript.ru/ecma[14.03.09 12:52:12]

Break :
break [ ]
. 12.9
Return :
return [ ] ;
. 12.10
With :
with ( )
. 12.11
Switch :
switch ( ) Case
. 12.11
Case :
{ Case }
{ Case Case }
. 12.11
Case :
Case
Case Case
. 12.11
Case :
case :
. 12.11
:
default :
. 12.12
:
:
. 12.13
ThrowStatement :
throw [ ] ;
. 12.14
Try :
try Catch
try Finally
try Catch Finally
. 12.14
Catch :

catch ( )

http://javascript.ru/ecma[14.03.09 12:52:12]

. 12.14
Finally :

finally

A.5
. 13
:
function ( ){ }
. 13
:
function ( ){ }
. 13
:

,
. 13
:

. 14
:

. 14
:


. 14
:

A.6 URI
. 15.1.3
uri :::
uri
. 15.1.3
Uri :::
Uri Uri
. 15.1.3
Uri :::
uri
uri
uri
http://javascript.ru/ecma[14.03.09 12:52:12]

. 15.1.3
uri :::
; / ? : @ & = + $ ,

. 15.1.3
uri :::
uri

uri
. 15.1.3
uri :::
%
. 15.1.3
uri :::

a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

. 15.1.3
uri :::

- _ . ! ~ * ' ( )

A.7
. 15.10.1
::

. 15.10.1
::

|
. 15.10.1
::
[]

. 15.10.1
::


. 15.10.1
::
^
$
\ b
\ B

http://javascript.ru/ecma[14.03.09 12:52:12]

. 15.10.1
::

?
. 15.10.1
::
*
+
?
{
{
{

}
,}
, }

. 15.10.1
::

Escape

( )
(?:
(?=
(?!
\

)
)
)

. 15.10.1
:: :
^ $ \ . * + ? ( ) [ ] { } |

. 15.10.1
Escape ::
Escape
Escape
Escape
. 15.10.1
Escape ::
Escape
c
Escape
Escape
Escape
. 15.10.1
Escape ::
f n r t v

. 15.10.1
::

a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

http://javascript.ru/ecma[14.03.09 12:52:12]

. 15.10.1
Escape ::

. 15.10.1
Escape ::
[

. 15.10.1
::
[ [ {^}] ]
[^ ]
. 15.10.1
::
[]

. 15.10.1
::


-
. 15.10.1
::


-
. 15.10.1
::

. 15.10.1
::
\ ] \ Escape
. 15.10.1
Escape ::
Escape
b

Escape
Escape

B
B
http://javascript.ru/ecma[14.03.09 12:52:12]

()

B.1
ECMAScript
escape-.
ECMAScript.

escape-
ECMAScript.
B.1.1
7.8.3
:

::

::
0 1 2 3 4 5 6 7

::
0

::
.
:: 0 0.
:: 1 1.
:: 2 2.
:: 3 3.
:: 4 4.
:: 5 5.
:: 6 6.
:: 7 7.
:: 0
.
::
(
8) .
B.1.2
7.8.4
:
http://javascript.ru/ecma[14.03.09 12:52:12]

Escape ::
Escape
Escape
Escape
Escape
Escape ::
[ ]
[ ]

::
0 1 2 3

::
4 5 6 7

Escape :: Escape
Escape .
Escape :: [
] ,
.
Escape ::
[ ] ,
( , 8) .
Escape ::
, (
, 8) .
Escape ::
, (
, 64 (.., 8 2 ) ), ( ,
8) .
:: 0 0.
:: 1 1.
:: 2 2.
:: 3 3.
:: 4 4.
:: 5 5.
:: 6 6.
:: 7 7.
B.2
ECMAScript
.
, .
http://javascript.ru/ecma[14.03.09 12:52:12]

B.2.1 escape (string)


escape .
,
escape-.
, 0xFF ,
escape- %xx . ,
0xFF , escape-
%uxxxx.
escape string ,
:
1. ToString( string ).
2. (1).
3. R .
4. k 0.
5. k (2), R .
6. ( 16- ) k
(1).
7.

(6)

69

" -

"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./

13.

8. (6) 256 - 11.


9. S - , "%uwxyz" , wxyz -
, (6).
10. 14.
11. S , "%xy" ,
, (6).

xy

12. 14.
13. S - , (6).
14. R - ,
R S.
15. k 1. 16. 5.

, RFC1738,
RFC1738 .

http://javascript.ru/ecma[14.03.09 12:52:12]

B.2.2 unescape (string)


unescape .
, escape- ,
escape, , .
unescape string ,
:
1. ToString( string ).
2. (1).
3. R .
4. k 0.
5. k (2), R .
6. c - k (1).
7. c % - 18.
8. k , (2)-6 - 14.
9. k +1 (1) u, - 14.
10. k +2, k +3, k +4 k +5 (1)
- 14.
11. c - , ,
k +2, k +3, k +4 k +5 (1).
12. k 1.
13. 18.
14. k , (2)-3 - 18.
15. k +1 k +2 (1)
- 18.
16. c - ,
k +1 k +2 (1).

17. k 2.
18. R - ,
R c .
19. k 1.
20. 5.

http://javascript.ru/ecma[14.03.09 12:52:12]

B.2.3 String.prototype.substr (start, length)


substr start length ,
, start
length ( , length
undefined). start , (sourceLength+
start ), sourceLength .
( String). :
1. ToString, this .
2. ToInteger( start ).
3. length undefined, + ; ToInteger( length ).
4. (1).
5. (2) - (2).
max((4)+ (2), 0).
6. min(max((3), 0), (4)- (5)).
7. (6) <= 0 - "".
8. , (6) (1),
(5).
length substr 2.

substr . ,
this String. ,
.
B.2.4 Date.prototype.getYear()


" 2000".

getFullYear,

getYear , :
1. t - .
2. t NaN - NaN.
3. (( t))-1900.
B.2.5 Date.prototype.setYear(year)


" 2000".

http://javascript.ru/ecma[14.03.09 12:52:12]

setFullYear,

setYear year,
:
1. t - ( ).
NaN, t +0.
2. ToNumber( year).
3. (2) NaN, [[Value]] this
NaN NaN.
4. (2) NaN 0 < = ToInteger((2)) <= 99, (4)
ToInteger((2)) + 1900. (4) (2).
5. ((4), (t), (t)).
6. UTC(((5), (t))).
7. [[Value]] this ((6)).
8. [[Value]] this.
B.2.6 Date.prototype.toGMTString()

toUTCString. toGMTString
. ECMAScript
toUTCString.
Function, Date.prototype.toGMTString
Function, Date.prototype.toUTCString.


,
ECMAScript.
InputElementDiv
InputElementRegExp

MultiLineComment

RegExp
Pattern
Program
Expression

Statement

WithStatement
With
AssignmentExpression

ArgumentList

Identifier

Initialiser

ExpressionNoIn In
DecimalDigit

DecimalDigits

LookaheadExample

LineTerminator
NonZeroDigit

IdentifierName
SourceCharacter
WhiteSpace

Comment
http://javascript.ru/ecma[14.03.09 12:52:12]

SingleLineComment

MultiLineCommentChars

MultiLineNotAsteriskChar

PostAsteriskCommentChars

MultiLineNotForwardSlashOrAsteriskChar
SingleLineCommentChars
SingleLineCommentChar

Token

Punctuator

NumericLiteral
StringLiteral

ReservedWord

Keyword
FutureReservedWord

NullLiteral
Null
BooleanLiteral
UnicodeEscapeSequence
Escape
IdentifierStart
IdentifierPart
UnicodeLetter

UnicodeCombiningMark

UnicodeDigit

UnicodeConnectorPunctuation

HexDigit

DivPunctuator

Literal
DecimalLiteral
HexIntegerLiteral

DecimalIntegerLiteral

ExponentPart

SignedInteger

ExponentIndicator

DoubleStringCharacters
SingleStringCharacters
DoubleStringCharacter

SingleStringCharacter

EscapeSequence Escape
CharacterEscapeSequence Escape
HexEscapeSequence
Escape
SingleEscapeCharacter
Escape
NonEscapeCharacter
Escape
EscapeCharacter Escape
RegularExpressionBody

RegularExpressionFlags
RegularExpressionLiteral

RegularExpressionFirstChar

RegularExpressionChars
RegularExpressionChar

NonTerminator

BackslashSequence

PostfixExpression

LeftHandSideExpression
ContinueStatement
Continue
BreakStatement Break
ThrowStatement Throw
ReturnStatement Return
PropertyName

StringNumericLiteral

StrWhiteSpace

StrNumericLiteral

StrWhiteSpaceChar

StrDecimalLiteral

StrUnsignedDecimalLiteral

FunctionDeclaration

FunctionExpression

FunctionBody

FormalParameterList

VariableDeclaration

VariableDeclarationNoIn In
PrimaryExpression

ArrayLiteral

ObjectLiteral

Elision
ElementList

PropertyNameAndValueList

MemberExpression

Arguments

NewExpression
New
CallExpression Call
UnaryExpression
MultiplicativeExpression

http://javascript.ru/ecma[14.03.09 12:52:12]

AdditiveExpression

ShiftExpression
RelationalExpression

RelationalExpressionNoIn
In
EqualityExpression

EqualityExpressionNoIn In
BitwiseANDExpression

BitwiseANDExpressionNoIn
In
BitwiseXORExpression

BitwiseXORExpressionNoIn
In
BitwiseORExpression

BitwiseORExpressionNoIn In
LogicalANDExpression

LogicalANDExpressionNoIn
In
LogicalORExpression

LogicalORExpressionNoIn In
ConditionalExpression

ConditionalExpressionNoIn
In
AssignmentExpressionNoIn
In
AssignmentOperator

Block

VariableStatement

EmptyStatement
ExpressionStatement

IfStatement
If
IterationStatement

LabelledStatement

SwitchStatement Switch
TryStatement
Try
StatementList

VariableDeclarationList
VariableDeclarationListNoIn
In
InitialiserNoIn In
EmptyStatement
CaseBlock
Case
CaseClauses
Case
CaseClause
Case
DefaultClause

Catch
Catch
Finally Finally
SourceElements
Scope

SourceElement

uri
uri
uriCharacters
Uri
uriCharacter
Uri
uriReserved
uri
uriUnescaped
uri
uriEscaped
uri
uriAlpha
uri
uriMark uri
Day

msPerDay

TimeWithinDay

DaysInYear

DayFromYear

TimeFromYear

YearFromTime

InLeapYear

MonthFromTime

DateFromTime

DayWithinYear

WeekDay
DaylightSavingTA

LocalTime

HourFromTime

msPerHour

HoursPerDay

MinFromTime

msPerMinute

MinutesPerHour
SecFromTime

msPerSecond

SecondsPerMinute

msFromTime

MakeTime

MakeDay
MakeDate

TimeClip

Disjunction

Alternative

http://javascript.ru/ecma[14.03.09 12:52:12]

Term

Assertion

Atom

Quantifier

QuantifierPrefix

PatternCharacter

AtomEscape
Escape
CharacterClass
DecimalEscape
Escape
CharacterEscape Escape
CharacterClassEscape
Escape
ControlEscape
Escape
ControlLetter

IdentityEscape Escape
ClassRanges

NonemptyClassRanges

ClassAtom

NonemptyClassRangesNoDash

ClassAtomNoDash
ClassEscape
Escape
CharSet
State

endIndex

captures

Continuation

Matcher
AssertionTester
EscapeValue
Escape
RepeatMatcher

IsWordChar

CharacterSetMatcher

Canonicalize

CharacterRange
OctalIntegerLiteral

OctalDigit

OctalEscapeSequence
Escape
ZeroToThree

FourToSeven

opt

[lookahead
set]
[
]
Result(n)
(n)
Type(x) (x)

http://javascript.ru/ecma

http://javascript.ru/ecma[14.03.09 12:52:12]

You might also like