var weapon = 'ak47';
var guns = ["ak47", 'm4a1'];
var guns2 = ["usp", 'cl'];
var hs = guns.indexOf(weapon) !== -1 ? true : false;
if(hs == true){
console.log('automat');
} else if (guns2.indexOf(weapon) !== -1 ? true : false){
console.log('pistol');
} else {
console.log('awp');
}
|