{ "id": "106219", "key": "AC-2677", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2012-12-10T17:40:48.000+0000", "created": "2012-12-10T14:47:24.000+0000", "labels": [ "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "updated": "2016-03-08T07:41:46.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "When an array is accessed using the for (var key in array_name), it returns an extra entry with key = 'contains' at the end of the array. This does not happen if the array is accessed but iterating a key to array_legth -1.\r\n\r\nSample code that demonstrates the issue:\r\n\r\n{code}\r\nfields2 = [4, 5, 6, 7, 8];\r\nfor (var key in fields2)\r\nTi.API.info('FORM FIELD KEY ' + key + 'TITLE::' + fields2[key]);\r\n\r\nfor (var k = 0; k < fields2.length; k++)\r\n\tTi.API.info('FORM FIELD KEY ' + fields2[k]);\r\n\r\nfields3 = ['4', '5', '6', '7', '8'];\r\nfor (var key in fields3)\r\nTi.API.info('FORM FIELD KEY ' + key + 'TITLE::' + fields3[key]);\r\n\r\nfor (var k = 0; k < fields3.length; k++)\r\n\tTi.API.info('FORM FIELD KEY ' + fields3[k]);\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Array has an extra entry with index = 'contains'", "creator": { "name": "wsaliba", "key": "wsaliba", "displayName": "Walid Saliba", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "wsaliba", "key": "wsaliba", "displayName": "Walid Saliba", "active": true, "timeZone": "America/New_York" }, "environment": "Titanium on Mac", "comment": { "comments": [ { "id": "230619", "author": { "name": "wsaliba", "key": "wsaliba", "displayName": "Walid Saliba", "active": true, "timeZone": "America/New_York" }, "body": "Found the source of the error.\n\nI had included a .js with the following statement:\n\nArray.prototype.contains = function(obj) {\n var i = this.length;\n while (i--) {\n if (this[i] === obj) {\n return true;\n }\n }\n return false;\n}\n\nWorks well on Android, but causes the error described above when the same application is ran on iOS.", "updateAuthor": { "name": "wsaliba", "key": "wsaliba", "displayName": "Walid Saliba", "active": true, "timeZone": "America/New_York" }, "created": "2012-12-10T15:54:45.000+0000", "updated": "2012-12-10T15:54:45.000+0000" }, { "id": "230629", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "If the JS you included is part of the Titanium SDK, then let me know and I'll re-open. I'd notify its author or something.", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-12-10T17:40:48.000+0000", "updated": "2012-12-10T17:40:48.000+0000" }, { "id": "280948", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Invalid issue. ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2013-11-24T22:18:18.000+0000", "updated": "2013-11-24T22:18:18.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }