this syntax using a variable suffix may help you:
item.prCtr1 === item['prCtr' + 1]
>Hi everybody,
>
>I found this page
>
>
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in>
>I am writing a function for checking profit centers. An item can have 6 profit centers. The values are saved as item.prCtr1, item.prCtr2, etc.
>
>I want to make sure that if they are specified (e.g. not 0/null), then they are all different.
>
>So, I am going to write like this
>
>
>if (item.prCtr1!=0 && item.prCtr1 in new Array(item.prCtr2, item.prCtr3, item.prCtr4, item.prCtr5, item.prCtr6) )
>
>The problem here that according to that reference, it will also compare with the array's index and so I may get false positives.
>
>Do you see a way to write the above code in a simple manner? Or I'd rather write 5 OR checks for all 6 of them?
>
>What do you think?
>
>Thanks in advance.
Thierry Nivelet
FoxinCloud
Give your VFP application a second life, web-based, in YOUR cloud
http://foxincloud.com/Never explain, never complain (Queen Elizabeth II)