mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 17:28:48 +00:00
LibJS: Implement the "instanceof" operator
This operator walks the prototype chain of the RHS value and looks for a "prototype" property with the same value as the prototype of the LHS. This is pretty cool. :^)
This commit is contained in:
parent
37fe16a99c
commit
a3d92b1210
Notes:
sideshowbarker
2024-07-19 08:05:41 +09:00
Author: https://github.com/awesomekling
Commit: a3d92b1210
6 changed files with 41 additions and 1 deletions
7
Libraries/LibJS/Tests/instanceof-basic.js
Normal file
7
Libraries/LibJS/Tests/instanceof-basic.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
function Foo() {
|
||||
this.x = 123;
|
||||
}
|
||||
|
||||
var foo = new Foo();
|
||||
if (foo instanceof Foo)
|
||||
console.log("PASS");
|
Loading…
Add table
Add a link
Reference in a new issue