tracker issue : CF-3833529

select a category, or use search below
(searches all categories and all time range)
Title:

Using index variable inside anonymous function called as a parameter to Arrayeach(Member funtions) gives undefined index

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): / ext-user (Priyatharsini K)

Created: 09/30/2014

Components: Mobile Support, Language Syntax

Versions: 11.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: 3.0 Final /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Mac 10 All,Win XP All

Vote Count: 0

Listed in the version 11.0.03.292480 Issues Fixed doc
Problem: Index is not defined for Arrayeach(member functions).

Method:
1. Run the below code:
<div id="test array each with array of strings" class="actual">
<cfclient>
<cfscript>
	myArray1 = ["Sagar","H","Ganatra","Adobe","Systems"];
	function printFunction1(any currentObject, any index) {
		writeOutput(currentObject & index & "<br>");
	}
myArray1.each(printFunction1);
	
</cfscript>
</cfclient>
</div>

Result:
Sagarundefined
Hundefined
Ganatraundefined
Adobeundefined
Systemsundefined

Expected:
Sagar1
H2
Ganatra3
Adobe4
Systems5

Workaround:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3833529

External Customer Info:
External Company:  
External Customer Name:  
External Customer Email:

Attachments:

Comments:

The issue is fixed and getting the expected output. Hence, closing this bug. (Comment added from ex-user id:prk)
Comment by Adobe D.
10807 | October 16, 2014 08:00:23 AM GMT