Unable to solve error in mouseHandler in tooltip

Hi there,

I am unable to solve the following error: “Uncaught TypeError: Cannot read property ‘bachelorsOrHigher’ of undefined”

The code is:
function handleMouseOver(countyDataItem) {
let matchedEducationDataItem = educationData.find((educationDataItem) => {
return educationDataItem["fips"] === countyDataItem["id"]
let percentageBorHigher = matchedEducationDataItem["bachelorsOrHigher"] etc (it’s all in line 84)

Does anyone know how I can solve this?

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36

Challenge: Visualize Data with a Choropleth Map

Link to the challenge:

I don’t think the argument being passed into handleMouseOver is what you think it is. Try adding console.log(countyDataItem); as the first line in the handler and see what it shows.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.