Closed
Bug 313568
Opened 20 years ago
Closed 20 years ago
function's length property is immutable
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: stryker330, Unassigned)
Details
A function's length is always equal to the number of formal parameters. It can't be changed. For ex:
function foo(a, b, c) {}
//foo.length is 3
foo.length = 10;
//foo.length is still 3
The getter function for it can't be defined either:
foo.__defineGetter__('length', function() {});
That throws this error: "redeclaration of const length"
All other browsers have the same bug/behavior. The ECMAScript spec only says it is "usually an integer that indicates the “typical” number of
arguments expected by the function" and doesn't specify whether it should be constant or not.
Comment 1•20 years ago
|
||
15.3.5.1 length
The value of the length property is usually an integer that indicates the “typical” number of arguments expected by the function. However, the language permits the function to be invoked with some other number of arguments. The behaviour of a function when invoked on a number of arguments other than the number specified by its length property depends on the function. This property has the attributes { DontDelete, ReadOnly, DontEnum }.
Did you read the last sentence?
/be
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•