{"action":"created","issue":{"url":"https://api.github.com/repos/jashkenas/backbone/issues/3842","labels_url":"https://api.github.com/repos/jashkenas/backbone/issues/3842/labels{/name}","comments_url":"https://api.github.com/repos/jashkenas/backbone/issues/3842/comments","events_url":"https://api.github.com/repos/jashkenas/backbone/issues/3842/events","html_url":"https://github.com/jashkenas/backbone/issues/3842","id":114123535,"number":3842,"title":"Object.prototype properties conflict with `_.defaults`","user":{"login":"qbolec","id":133093,"avatar_url":"https://avatars.githubusercontent.com/u/133093?v=3","gravatar_id":"","url":"https://api.github.com/users/qbolec","html_url":"https://github.com/qbolec","followers_url":"https://api.github.com/users/qbolec/followers","following_url":"https://api.github.com/users/qbolec/following{/other_user}","gists_url":"https://api.github.com/users/qbolec/gists{/gist_id}","starred_url":"https://api.github.com/users/qbolec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qbolec/subscriptions","organizations_url":"https://api.github.com/users/qbolec/orgs","repos_url":"https://api.github.com/users/qbolec/repos","events_url":"https://api.github.com/users/qbolec/events{/privacy}","received_events_url":"https://api.github.com/users/qbolec/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jashkenas/backbone/labels/bug","name":"bug","color":"ff0000"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-10-29T19:03:10Z","updated_at":"2015-10-29T20:55:24Z","closed_at":null,"body":"I run into an issue today, as Firefox added support for a new `watch` function to each Object.prototype, while I was unfortunate to use 'watch' as a name of an attribute of my Model.\r\nThe problem is caused by Model's constructor line:\r\n```\r\nattrs = _.defaults({}, attrs, _.result(this, 'defaults'));\r\n```\r\nand the fact that lodash's _.defaults implementation sees that `typeof {}.watch` is not `'undefined` so it does not want to override it with the one found in `attrs`.\r\nNot sure if the issue is with Backbone, Lodash, or Firefox, but one thing is sure: while I can (and do) avoid today's magic properties (like `constructor`, `valueOf` etc.) I can not really anticipate what word will be forbiden in future, and don't like the idea of updating my app in future whenever one of my favorite words get's banned."},"comment":{"url":"https://api.github.com/repos/jashkenas/backbone/issues/comments/152321043","html_url":"https://github.com/jashkenas/backbone/issues/3842#issuecomment-152321043","issue_url":"https://api.github.com/repos/jashkenas/backbone/issues/3842","id":152321043,"user":{"login":"akre54","id":931368,"avatar_url":"https://avatars.githubusercontent.com/u/931368?v=3","gravatar_id":"","url":"https://api.github.com/users/akre54","html_url":"https://github.com/akre54","followers_url":"https://api.github.com/users/akre54/followers","following_url":"https://api.github.com/users/akre54/following{/other_user}","gists_url":"https://api.github.com/users/akre54/gists{/gist_id}","starred_url":"https://api.github.com/users/akre54/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akre54/subscriptions","organizations_url":"https://api.github.com/users/akre54/orgs","repos_url":"https://api.github.com/users/akre54/repos","events_url":"https://api.github.com/users/akre54/events{/privacy}","received_events_url":"https://api.github.com/users/akre54/received_events","type":"User","site_admin":false},"created_at":"2015-10-29T20:55:24Z","updated_at":"2015-10-29T20:55:24Z","body":"@jdalton what do you mean? I'm referring to this case:\r\n\r\n```js\r\nvar Model = Backbone.Model.extend({\r\n  defaults: {\r\n    foo: true\r\n  }\r\n});\r\n\r\nvar model = new Model({foo: undefined});\r\n\r\n// with _.defaults:\r\nmodel.get('foo'); // true\r\n\r\n// with _.extend:\r\nmodel.get('foo'); // undefined\r\n```"}}