Tell me what is the best and easiest way to turn the table of tariff zones of "New Mail" by the link http://novaposhta.ua/uploads/misc/doc/taryfni_zony.pdf into conditions in pure Javascript?
For those who do not know: in the left vertical column is taken the area from which one person sends the goods, and in the right horizontal bar is taken the area where the other person accepts the sent goods. At the intersection of the regions, the number of the tariff zone is obtained (the farther one region is from another, the larger the number).
The regions of Ukraine were previously translated into numbers ie Kiev region, for example, is 9-ka (9th in order in the table), Odessa 14, Dneprovskaya 3, Lvov 12, etc.
The first thing that comes to mind is:
if(numberOfSenderRegion == 9 && numberOfReceiverRegion == 3 || numberOfSenderRegion == 3 && numberOfReceiverRegion == 9 || numberOfSenderRegion == 9 && numberOfSenderRegion == 14 || numberOfReceiverRegion == 14 && numberOfReceiverRegion == 9 || numberOfSenderRegion == 9 && numberOfSenderRegion == 12 || numberOfReceiverRegion == 12 && numberOfReceiverRegion == 9) { var numberOfZone = 4; } and so it turns out who knows how many similar conditions need to be prescribed only for the 4th zone
Is there a simpler way?
ps. zone 0 (sending within one region) is not considered; there is one condition enough:
if(numberOfSenderRegion == numberOfReceiverRegion) { var numberOfZone = 0; }