const a = Ĭonsole.log(a.x, a.y, a.z) // 5, 6, undefined still no z, obviously If the field still can't be found, the property is looked up on the prototype of the prototype, etc. When you look up a field on the object using either obj.field or obj syntax (they are different way of doing the same thing), and the field is not present in the object, the JS runtime looks for the same field on the prototype. ![]() Each of them has a magic _proto_ field that can point to any object which will be the prototype of the first one.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |