TypeError: response.hits[i].hit_set_id.toLowercase is not a function

I get that error on the console whenever I run this code:

const response = JSON.parse(`{"version":1,"tests":[],"hits":[{"title":"Answer one of our market research surveys (~ 2 to 12 minutes + 1-2 minutes for demographics)","hit_set_id":"36R3RQSDQUGLBEZ545II11576K307C","requester_name":"UXreviewer.io ResearchLab","requester_id":"A1HXBVQANVSV6H","reward":"0.26","description":"Give us your opinion about usability, products, and marketing. The survey itself will be about ~ 2 to 12 minutes; in addition, 1-2 minutes for demographics are required beforehand.","duration_in_seconds":3600,"qualifications":{"project_requirements":[{"qualification_type_id":"00000000000000000071","comparator":"In","worker_action":"AcceptHit","qualification_values":["AL","AM","AN","AQ","AR","AT","AU","BE","BG","BY","CU","CZ","DE","DK","ES","ET","FR","GE","GF","IL","IT","JP","NL","NO","NP","PF","PL","PT","TF","US"],"caller_meets_requirement":true,"qualification_type":{"qualification_type_id":"00000000000000000071","name":"Location","visibility":true,"description":"The Location Qualification represents the location you specified with your mailing address.  Some HITs may only be available to residents of particular countries, states, provinces or cities.","has_test":false,"is_requestable":false,"keywords":"location"},"caller_qualification_value":{"integer_value":null,"locale_value":{"country":"US","subdivision":"IL"}}}]},"last_seen":1635091621,"requester_hourly":null}]}
`);

for (let i = 0; i < response.hits.length; i++) {
      console.log(response.hits[i]);
      console.log(response.hits[i].hit_set_id);
      const hitId = response.hits[i].hit_set_id.toLowercase();
      const title = response.hits[i].title.toLowercase();
      const requesterName = response.hits[i].requester_name.toLowercase();
      const requesterId = response.hits[i].requester_id.toLowercase();
}

As you can tell from the response object, response.hits[i].hit_set_id is a string, yet when I try to call toLowerCase() on it I get that exception. I honestly have no idea what’s happening.

Answer

.toLowerCase() is case sensitive.