mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +00:00
LibJS: Add length property to ScriptFunction
This commit is contained in:
parent
cd3e2690eb
commit
4d931b524d
3 changed files with 37 additions and 0 deletions
17
Libraries/LibJS/Tests/function-length.js
Normal file
17
Libraries/LibJS/Tests/function-length.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
function assert(x) { if (!x) throw 1; }
|
||||
|
||||
try {
|
||||
function foo() { }
|
||||
assert(foo.length === 0);
|
||||
assert((foo.length = 5) === 5);
|
||||
assert(foo.length === 0);
|
||||
|
||||
function bar(a, b, c) {}
|
||||
assert(bar.length === 3);
|
||||
assert((bar.length = 5) === 5);
|
||||
assert(bar.length === 3);
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue