[AC-452] Adding 'map' to an array within an causes 'undefined is not a function'
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Invalid |
Resolution Date | 2015-11-07T17:45:28.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | ios |
Reporter | Lawrence Wilson |
Assignee | Shak Hossain |
Created | 2015-10-09T09:49:27.000+0000 |
Updated | 2015-11-07T17:45:28.000+0000 |
Description
The following code:
[ERROR] : Script Error {
[ERROR] : column = 15;
[ERROR] : line = 55;
[ERROR] : message = "undefined is not a function (evaluating 'harry.push(target)')";
[ERROR] : sourceURL = "file:///Users/.../alloy/controllers/index.js";
[ERROR] : stack = "Controller@file:///Users/.../alloy/controllers/index.js:55:15\ncreateController@file:///Users/.../alloy.js:264:54\nglobal code@file:///Users/.../app.js:3:23";
[ERROR] : }
{noformat}
var target = 'map1';
var listeners = [];
var harry = listeners[target] || [];
Ti.API.debug(harry);
harry.push(target);
Ti.API.debug(target);
Ti.API.debug(harry);
Produces the following:
{noformat}
[DEBUG] : (
[DEBUG] : )
[DEBUG] : map1
[DEBUG] : (
[DEBUG] : map1
[DEBUG] : )
{noformat}
However, change the target value to 'map'
var target = 'map';
And the following occurs
{noformat}
[DEBUG] :
Hi [~lawrence.wilson@abannan.com], It's not an issue, "map" is the keyword for JavaScript that's why it shows this error. Thanks.