{"action":"created","issue":{"url":"https://api.github.com/repos/getify/You-Dont-Know-JS/issues/621","labels_url":"https://api.github.com/repos/getify/You-Dont-Know-JS/issues/621/labels{/name}","comments_url":"https://api.github.com/repos/getify/You-Dont-Know-JS/issues/621/comments","events_url":"https://api.github.com/repos/getify/You-Dont-Know-JS/issues/621/events","html_url":"https://github.com/getify/You-Dont-Know-JS/issues/621","id":124612669,"number":621,"title":"\"this & Object Prototypes\" chapter 5:Prototypes [[Prototype]] section","user":{"login":"MehdiRaash","id":6185507,"avatar_url":"https://avatars.githubusercontent.com/u/6185507?v=3","gravatar_id":"","url":"https://api.github.com/users/MehdiRaash","html_url":"https://github.com/MehdiRaash","followers_url":"https://api.github.com/users/MehdiRaash/followers","following_url":"https://api.github.com/users/MehdiRaash/following{/other_user}","gists_url":"https://api.github.com/users/MehdiRaash/gists{/gist_id}","starred_url":"https://api.github.com/users/MehdiRaash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MehdiRaash/subscriptions","organizations_url":"https://api.github.com/users/MehdiRaash/orgs","repos_url":"https://api.github.com/users/MehdiRaash/repos","events_url":"https://api.github.com/users/MehdiRaash/events{/privacy}","received_events_url":"https://api.github.com/users/MehdiRaash/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-02T21:37:42Z","updated_at":"2016-01-05T09:32:17Z","closed_at":null,"body":"As I was figuring out about how [[Get]] in **myObject.a** works(=process continues until chain ends), everything was allright!\r\n   \r\n    var anotherObject = {\r\n        a: 2\r\n    };\r\n\r\n    // create an object linked to `anotherObject`\r\n    var myObject = Object.create( anotherObject );\r\n\r\n    myObject.a; // 2\r\n\r\nbut I came up with a question which is \"what will happen if no prototype was set, How does getter work in this situation\":\r\n\r\n     var myObject = Object.create(null);\r\n     myObject.a = 7;\r\n     myObject.toString(); //Uncaught TypeError: myObject.toString is not a function\r\n\r\nso look-up fails cause there's no link, beside that no [[Get]] should be found.\r\n\r\n     myObject.a; // 7\r\n\r\nbut this works fine... how?! : \r\n\r\nbut I feel there should be a notice for that in this section.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/getify/You-Dont-Know-JS/issues/comments/168946588","html_url":"https://github.com/getify/You-Dont-Know-JS/issues/621#issuecomment-168946588","issue_url":"https://api.github.com/repos/getify/You-Dont-Know-JS/issues/621","id":168946588,"user":{"login":"donvadicastro","id":8946681,"avatar_url":"https://avatars.githubusercontent.com/u/8946681?v=3","gravatar_id":"","url":"https://api.github.com/users/donvadicastro","html_url":"https://github.com/donvadicastro","followers_url":"https://api.github.com/users/donvadicastro/followers","following_url":"https://api.github.com/users/donvadicastro/following{/other_user}","gists_url":"https://api.github.com/users/donvadicastro/gists{/gist_id}","starred_url":"https://api.github.com/users/donvadicastro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donvadicastro/subscriptions","organizations_url":"https://api.github.com/users/donvadicastro/orgs","repos_url":"https://api.github.com/users/donvadicastro/repos","events_url":"https://api.github.com/users/donvadicastro/events{/privacy}","received_events_url":"https://api.github.com/users/donvadicastro/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T09:32:17Z","updated_at":"2016-01-05T09:32:17Z","body":"By default, when you are using classic object creation var a = {}, you are creating new object which is inherited by base Object object. It is the same as to write:\r\n```\r\nObject.create(Object.prototype)\r\n```  \r\n\r\nSo using this syntax you are free to use base Object methods and properties, like .toString(), from your inherited object.\r\n\r\nUsing prototype-less object creation (Object.create(null)) - you are creating object which is not inherited from base Object class so you can't access Object specific methods, like .toString(), but you are free still to use getters and setters, which aligns to language specifications, so are accessible from any valid object.\r\n"}}