Titanium JIRA Archive
Appcelerator Community (AC)

[AC-452] Adding 'map' to an array within an causes 'undefined is not a function'

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionInvalid
Resolution Date2015-11-07T17:45:28.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsios
ReporterLawrence Wilson
AssigneeShak Hossain
Created2015-10-09T09:49:27.000+0000
Updated2015-11-07T17:45:28.000+0000

Description

The following code:
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] : [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}

Comments

  1. Motiur Rahman 2015-10-11

    Hi [~lawrence.wilson@abannan.com], It's not an issue, "map" is the keyword for JavaScript that's why it shows this error. Thanks.

JSON Source