AI

Classify products based on their description. Use includes() and startsWith().

Your Task:

  • Create hasSearchTerm (true if description contains searchTerm)
  • Create isHighPerformance (true if description starts with "High-performance")
  • Create categoryMessage based on conditions:
    • Both true: "Premium [term] device"
    • Term only: "Great [term] product"
    • HighPerf only: "High-end device"
    • Neither: "Standard product"
TypeScript Solution
Loading...

Submit your code to see test results