About Object.getPrototypeOf and Object._proto_

Code:

  <script>
            function Dog(){}
            var dog = new Dog();
            var dog1 = Object.create(dog);
            // console.log(dog1._proto_);
            console.log(Object.getPrototypeOf(dog1));
   </script>
        
The instance dog1 is created using Object.create in the

code, so the prototype of the instance dog1 should be dog. But two problems were encountered in the actual testing:

  1. console.log (dog1._proto_) outputs undefined. After Baidu, I saw a lot of saying that _ proto_ is a non-standard usage, which is not recommended until after es6, but the browser (I am using the latest version of chrome) should be parsable. Why output undefined?

2. So I switched to getPrototypeOf, but the output was not the prototype dog of dog1, but the constructor Dog.

confused about the above two points, solve


1. The first is the _ _ proto__ access prototype (two underscores)
2. Using var dog1 = Object.create (dog) means that an object is created and its prototype points to the dog object, so executing Object.getPrototypeOf (dog1) gets the dog object

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8a08e-4e474.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8a08e-4e474.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?