I am trying to loop through an array but it am not able to see an intended output. Instead when I tried debugging, it says that the variable r
is undefined. This is the variable that am using for the for loop
.
Debugging Interface
Code in Context
function checkClassType(idOfEl,dropElem)
{
var ElementType="";
if (dropElem == "stream ui-draggable") {
for(var r=0;r<100;r++)
{
if(createdImportStreamArray[r][0]==idOfEl)
{
ElementType="importStream";
finalArray[idOfEl-1][2]= createdImportStreamArray[r][1]; //Selected Stream from Predefined Streams
finalArray[idOfEl-1][3]= createdImportStreamArray[r][2]; //asName
}
else if(createdExportStreamArray[r][0]==idOfEl)
{
ElementType="exportStream";
finalArray[idOfEl-1][2]= createdExportStreamArray[r][1]; //Selected Stream from Predefined Streams
finalArray[idOfEl-1][3]= createdExportStreamArray[r][2]; //asName
}
else
{
ElementType="definedStream";
finalArray[idOfEl-1][2]= createdDefinedStreamArray[r][1]; //Stream Name
finalArray[idOfEl-1][3]= createdExportStreamArray[r][4]; //Number of Attributes
finalArray[idOfEl-1][4]=[];
for(var f=0;f<createdExportStreamArray[r][4];f++)
{
finalArray[idOfEl-1][4][f][0]=createdDefinedStreamArray[r][2][f][0]; //Attribute Name
finalArray[idOfEl-1][4][f][1]=createdDefinedStreamArray[r][2][f][1]; // Attribute Type
}
}
}
}
else if (dropElem == "wstream ui-draggable") {
//Continues...
But, according to my assumption, r
will keep on getting values ranging from 0 to 99. So how is it possible for it to be undefined?