In the code below, priorityData array is in [80]="High" format i.e 80 is the integer value of High. I want to extract and use integer value 80 whenever my string is equivalent to "High". How should I do that?
if (service.priorityData[i] === priorityString) {
logger.info("Priority string", service.priorityData[i].values());
return service.priorityData[i].values();
} else {
return null;
}
service.priorityData = {0 : "None", 20: "Low, 80: "High"}
But it doesn't return anything when I use this code.
[80]="High"a string or are you saying that the 80th element in the array is equal to"High".service.priorityData[i].priorityData[key] === "High"thenkeywill be 80.iwill be the value. Which would be the exact same thing as going back through the keys of an object.