I'm trying to determine if a product code is allowed to be transported by a set transportation mode. The transportation codes are based on the following table:
Car = 1
Truck = 2
Train = 4
I might be given the code of 1 which means the item can be transported by Car, 3 means it can go by Car or Truck (1+2=3), or 7 means it can go by Car, Truck or Train (1+2+4=7), and so forth.
How can I make this work?
var transmode = 5;
if(productcode "in" transmode){do something;}