mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-26 03:32:20 +00:00
docs(symbol): edit symbol/Symbol.instanceOf
This commit is contained in:
parent
88248d97c3
commit
1ac918c804
@ -492,6 +492,13 @@ class Even {
|
||||
}
|
||||
}
|
||||
|
||||
// 等同于
|
||||
const Even = {
|
||||
[Symbol.hasInstance](obj) {
|
||||
return Number(obj) % 2 === 0;
|
||||
}
|
||||
};
|
||||
|
||||
1 instanceof Even // false
|
||||
2 instanceof Even // true
|
||||
12345 instanceof Even // false
|
||||
|
Loading…
x
Reference in New Issue
Block a user