Example of 'complex' conditional

This logistics example models how five operational factors—weather conditions, traffic levels, driver experience, route complexity, and vehicle type—combine to determine delivery performance outcomes (Excellent, Good, Fair, or Poor).

Longer but clearer implementation

// Alternative approach using lookup table for exact behavior matching
function getDeliveryPerformanceOptimized(weather, traffic, experience, route, vehicle) {
  // Create composite key
  const key = `${weather}_${traffic}_${experience}_${route}_${vehicle}`;
  
  // Lookup table with only the unique combinations
  const performanceMap = {
    // Clear weather, Light traffic, Experienced
    'Clear_Light_Experienced_Simple_Bike': 'Good',
    'Clear_Light_Experienced_Complex_Bike': 'Good',
    'Clear_Light_Experienced_Simple_Van': 'Excellent',
    'Clear_Light_Experienced_Complex_Van': 'Excellent',
    'Clear_Light_Experienced_Simple_Truck': 'Excellent',
    'Clear_Light_Experienced_Complex_Truck': 'Excellent',
    'Clear_Light_Experienced_Simple_Motorcycle': 'Excellent',
    'Clear_Light_Experienced_Complex_Motorcycle': 'Excellent',
    
    // Clear weather, Light traffic, New
    'Clear_Light_New_Simple_Truck': 'Fair',
    'Clear_Light_New_Complex_Truck': 'Fair',
    'Clear_Light_New_Simple_Bike': 'Fair',
    'Clear_Light_New_Complex_Bike': 'Fair',
    'Clear_Light_New_Simple_Van': 'Good',
    'Clear_Light_New_Complex_Van': 'Good',
    'Clear_Light_New_Simple_Motorcycle': 'Good',
    'Clear_Light_New_Complex_Motorcycle': 'Good',
    
    // Clear weather, Heavy traffic, Experienced
    'Clear_Heavy_Experienced_Simple_Motorcycle': 'Excellent',
    'Clear_Heavy_Experienced_Complex_Motorcycle': 'Good',
    'Clear_Heavy_Experienced_Simple_Truck': 'Fair',
    'Clear_Heavy_Experienced_Complex_Truck': 'Fair',
    'Clear_Heavy_Experienced_Simple_Van': 'Good',
    'Clear_Heavy_Experienced_Complex_Van': 'Good',
    'Clear_Heavy_Experienced_Simple_Bike': 'Good',
    'Clear_Heavy_Experienced_Complex_Bike': 'Fair',
    
    // Clear weather, Heavy traffic, New
    'Clear_Heavy_New_Simple_Truck': 'Poor',
    'Clear_Heavy_New_Complex_Truck': 'Poor',
    'Clear_Heavy_New_Simple_Motorcycle': 'Good',
    'Clear_Heavy_New_Complex_Motorcycle': 'Fair',
    'Clear_Heavy_New_Simple_Van': 'Fair',
    'Clear_Heavy_New_Complex_Van': 'Fair',
    'Clear_Heavy_New_Simple_Bike': 'Fair',
    'Clear_Heavy_New_Complex_Bike': 'Poor',
    
    // Storm weather, Light traffic, Experienced
    'Storm_Light_Experienced_Simple_Van': 'Good',
    'Storm_Light_Experienced_Complex_Van': 'Fair',
    'Storm_Light_Experienced_Simple_Truck': 'Good',
    'Storm_Light_Experienced_Complex_Truck': 'Fair',
    'Storm_Light_Experienced_Simple_Motorcycle': 'Fair',
    'Storm_Light_Experienced_Complex_Motorcycle': 'Poor',
    'Storm_Light_Experienced_Simple_Bike': 'Poor',
    'Storm_Light_Experienced_Complex_Bike': 'Poor',
    
    // Storm weather, Light traffic, New
    'Storm_Light_New_Simple_Van': 'Fair',
    'Storm_Light_New_Complex_Van': 'Poor',
    'Storm_Light_New_Simple_Truck': 'Fair',
    'Storm_Light_New_Complex_Truck': 'Poor',
    'Storm_Light_New_Simple_Motorcycle': 'Poor',
    'Storm_Light_New_Complex_Motorcycle': 'Poor',
    'Storm_Light_New_Simple_Bike': 'Poor',
    'Storm_Light_New_Complex_Bike': 'Poor',
    
    // Storm weather, Heavy traffic, Experienced
    'Storm_Heavy_Experienced_Simple_Van': 'Fair',
    'Storm_Heavy_Experienced_Complex_Van': 'Poor',
    'Storm_Heavy_Experienced_Simple_Truck': 'Poor',
    'Storm_Heavy_Experienced_Complex_Truck': 'Poor',
    'Storm_Heavy_Experienced_Simple_Motorcycle': 'Poor',
    'Storm_Heavy_Experienced_Complex_Motorcycle': 'Poor',
    'Storm_Heavy_Experienced_Simple_Bike': 'Poor',
    'Storm_Heavy_Experienced_Complex_Bike': 'Poor'
  };
  
  // Return result with fallback - all Storm_Heavy_New combinations are 'Poor'
  return performanceMap[key] || 'Poor';
}

Concise, but hard to parse implementation

function getDeliveryPerformanceHierarchical(weather, traffic, experience, route, vehicle) {
  // Define scoring system for each factor
  const scores = {
    weather: weather === 'Clear' ? 2 : 0,
    traffic: traffic === 'Light' ? 2 : 0,
    experience: experience === 'Experienced' ? 2 : 0,
    route: route === 'Simple' ? 1 : 0,
    vehicle: {
      'Van': 2,
      'Truck': 1,
      'Motorcycle': 1,
      'Bike': 0
    }[vehicle]
  };

  // Calculate total score
  const totalScore = scores.weather + scores.traffic + scores.experience +
                    scores.route + scores.vehicle;

  // Map score ranges to performance levels
  if (totalScore >= 7) return 'Excellent';
  if (totalScore >= 5) return 'Good';
  if (totalScore >= 3) return 'Fair';
  return 'Poor';
}

// Most concise version using mathematical approach
function getDeliveryPerformanceCompact(weather, traffic, experience, route, vehicle) {
  const w = weather === 'Clear' ? 3 : 0;
  const t = traffic === 'Light' ? 2 : 0;
  const e = experience === 'Experienced' ? 2 : 0;
  const r = route === 'Simple' ? 1 : 0;
  const v = {'Van': 3, 'Truck': 2, 'Motorcycle': 2, 'Bike': 1}[vehicle];

  const score = w + t + e + r + v;
  return ['Poor', 'Poor', 'Poor', 'Fair', 'Fair', 'Good', 'Good', 'Excellent', 'Excellent', 'Excellent', 'Excellent'][Math.min(score, 10)];