I'm trying to make a search function, but I'm not sure how I should implement this. I want the function to take the input string and find the string that is closest to the input and return it.
Table:
{
"Death": { "Value": 190000, "Demand": 4, "Trend": 1, "Tier": "S" },
"Legendary Borul (Alternative)": { "Value": 125000, "Demand": 2, "Trend": 1, "Tier": "S" },
"Club Beast": { "Value": 50000, "Demand": 6, "Trend": 1, "Tier": "S" },
"Dark Wing": { "Value": 19800, "Demand": 6, "Trend": 1, "Tier": "S" },
"Zaruto (GRR III)": { "Value": 18800, "Demand": 6, "Trend": 1, "Tier": "S" },
"First Wood Bender": { "Value": 17000, "Demand": 8, "Trend": 1, "Tier": "S" },
"Old Will": { "Value": 14500, "Demand": 5, "Trend": 1, "Tier": "S" },
"Martial Artist": { "Value": 12000, "Demand": 3, "Trend": 6, "Tier": "S" },
"Expert Sorcerer": { "Value": 11250, "Demand": 5, "Trend": 1, "Tier": "S" },
"Zaruto (GRR II)": { "Value": 9600, "Demand": 8, "Trend": 7, "Tier": "S" },
"Sandwhich Leader / Mecha Frieza": { "Value": 1050000, "Demand": 0, "Trend": 4, "Tier": "S" },
"First Wood Bender (Sage)": { "Value": "N/A", "Demand": 0, "Trend": 4, "Tier": "S" }
}
Example:
search("legen"); // --> Output:
"Legendary Borul (Alternative)": { "Value": 125000, "Demand": 2, "Trend": 1, "Tier": "S" },