Jump to content

indexOf Array


gandalf98

Recommended Posts

Hello all,

 

Need help with finding the index of an array element. I've created an array and called it CpnArray. When I attempt the following:

 

CpnArray.indexOf(CpnVrsn)

 

FusionPro tells me that CpnArray.indexOf is not a function.

 

I don't want to set up an external file and look up the record... That is going to eat up too much memory and time for this job.

 

Can I not look up the index of an element in an array? That seems way to simple of a Javascript concept to not be implemented.

 

Please help!

Link to comment
Share on other sites

Hello all,

 

Need help with finding the index of an array element. I've created an array and called it CpnArray. When I attempt the following:

 

CpnArray.indexOf(CpnVrsn)

 

FusionPro tells me that CpnArray.indexOf is not a function.

 

I don't want to set up an external file and look up the record... That is going to eat up too much memory and time for this job.

 

Can I not look up the index of an element in an array? That seems way to simple of a Javascript concept to not be implemented.

 

Please help!

 

indexOf is a method of the String object and returns the starting position of a search string within another string. Arrays are not really searchable in that respect. What are you trying to accomplish with this array?

Link to comment
Share on other sites

I see. I was attempting to use an array of Letters that correspond to page numbers in a PDF file for variable coupons:

 

 

var CpnArray = [ "A", "B", "C", "D", etc. ];

 

when my data file came as version B, I wanted to look up the index of letter B, which would tell me to place page 2 of my coupon file.

 

if I were to declare the variable as a string ("ABCDEFG"), I then could use indexOf?

 

Thanks for your help... I only know enough to be dangerous.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...