mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibJS: Add the Object.getOwnPropertySymbols method
This commit is contained in:
parent
a2da3f97ef
commit
bd9e20ef79
Notes:
sideshowbarker
2024-07-18 12:21:49 +09:00
Author: https://github.com/IdanHo
Commit: bd9e20ef79
Pull-request: https://github.com/SerenityOS/serenity/pull/8022
Reviewed-by: https://github.com/linusg
5 changed files with 44 additions and 15 deletions
|
@ -0,0 +1,16 @@
|
|||
test("use with array", () => {
|
||||
let names = Object.getOwnPropertySymbols([1, 2, 3]);
|
||||
console.log(names);
|
||||
expect(names).toEqual([]);
|
||||
});
|
||||
|
||||
test("use with object", () => {
|
||||
let names = Object.getOwnPropertySymbols({ [Symbol.iterator]: 1, [Symbol.species]: 2 });
|
||||
expect(names).toEqual([Symbol.iterator, Symbol.species]);
|
||||
});
|
||||
|
||||
test("use with object with string keys", () => {
|
||||
let symbol = Symbol("bar");
|
||||
let names = Object.getOwnPropertySymbols({ foo: 1, [symbol]: 2, baz: 3 });
|
||||
expect(names).toEqual([symbol]);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue