I went through different answers on forums but could not find a solution. So I have an array like this:
var valuesArray = ["negative", "underweight", "neutral", "overweight", "positive"];
I have two variables:
var previousRating
and var currentRating
which dynamically get assigned with one of the values from valuesArray
.
I am trying to find index of previousRating
and currentRating
in valuesArray
like this:
var prevRatingCounter = valuesArray.indexOf(previousRating.toLowerCase());
var curRatingCouter = valuesArray.indexOf(currentRating.toLowerCase());
previousRating
and curRating
are string values but still I am getting error:
Object doesn't support this property or method
Can someone please help me figure this out. Thank you.