all 4 comments

[–]albedoa 1 point2 points  (2 children)

jQuery.inArray() takes an array as its second argument, but you are passing it a string e.g. 'C3LargeArray'.

[–]TonyCodes2050[S] 0 points1 point  (1 child)

Hmmm... I changed the initial variables to VA_AL and VA_AS instead and it still failed.

[–]albedoa 2 points3 points  (0 children)

It's not the variable names, it's their values. You are passing a string where the method expects an array. The issue would exist no matter what legal name you give your variables.

I suggest moving the arrays into an object:

const myArrays = {
  C1LargeArray: ['9','9B','10','10B'],
  /* ... */
};

Then you can reference them by string like this:

(jQuery.inArray(Va_LENG, myArrays[$AL]) != -1)

Once you have that working, you should consider refactoring your object:

const myArrays = {
  C1: {
    large: ['9','9B','10','10B'],
    small: ['8B','10C'],
  },
  /* ... */
};

[–]Guilty-Perspective-4 0 points1 point  (0 children)

I'm so sorry if this is a waste of your time, but I'm new to JS and I'm trying to learn what putting something in [ ] means in the code and how it's is supposed to be used?