{"action":"opened","issue":{"url":"https://api.github.com/repos/lodash/lodash/issues/2351","repository_url":"https://api.github.com/repos/lodash/lodash","labels_url":"https://api.github.com/repos/lodash/lodash/issues/2351/labels{/name}","comments_url":"https://api.github.com/repos/lodash/lodash/issues/2351/comments","events_url":"https://api.github.com/repos/lodash/lodash/issues/2351/events","html_url":"https://github.com/lodash/lodash/issues/2351","id":155653570,"number":2351,"title":"fill produces unexpected behaviour when manipulating filled array afterwards","user":{"login":"renewooller","id":3643599,"avatar_url":"https://avatars.githubusercontent.com/u/3643599?v=3","gravatar_id":"","url":"https://api.github.com/users/renewooller","html_url":"https://github.com/renewooller","followers_url":"https://api.github.com/users/renewooller/followers","following_url":"https://api.github.com/users/renewooller/following{/other_user}","gists_url":"https://api.github.com/users/renewooller/gists{/gist_id}","starred_url":"https://api.github.com/users/renewooller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renewooller/subscriptions","organizations_url":"https://api.github.com/users/renewooller/orgs","repos_url":"https://api.github.com/users/renewooller/repos","events_url":"https://api.github.com/users/renewooller/events{/privacy}","received_events_url":"https://api.github.com/users/renewooller/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-19T04:48:03Z","updated_at":"2016-05-19T04:48:03Z","closed_at":null,"body":"After using fill to create an array, then mapping or for looping over the contents of the array to update it using an index, the result is as though the value the index within each iteration is the same as the last index. \r\n\r\nWhen using a pure JS fill, it behaves as expected. \r\n\r\nI've written a test case comparing javascript fill with lodash fill.\r\n\r\n`var a = new Array(3).fill(undefined);\r\n\r\nfor(var i = 0; i< a.length; i++) {\r\n    a[i] = {\"a\":i}\r\n}\r\n\r\nconsole.log(a);\r\n\r\nfor(var i = 0; i< a.length; i++) {\r\n    a[i]['a'] = i+10\r\n}\r\n\r\nconsole.log(a)\r\n\r\na = a.map((v, i) => {v['b'] = i; return v})\r\n\r\nconsole.log(a);\r\n\r\nconsole.log(\"lodash fill\");\r\n\r\nvar b = _.fill(Array(3), {\"a\":\"b\"})\r\n\r\nconsole.log(b)\r\n\r\nb = b.map((v,i) => {v['a'] = i; return v})\r\n\r\nconsole.log(b);\r\n\r\nfor(var i=0; i<b.length; i++) {\r\n    b[i]['a'] = i*2;\r\n}\r\n\r\nconsole.log(b);`"}}