How do I fix this error: "Uncaught TypeError: is not a function"?

Hi all

I’m getting this error in my console:

“Uncaught TypeError: is not a function

How could I fix it?

Thanks for your time


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 Heat Map

Link to the challenge:

Hi @jaimeggb ,

Check out the json data which you are fetching. unmappedDataset is an object and not an array. So using map function on unmappedDataset will throw an error.

You could simply extract the monthly variance by using the object[key name] syntax as below:
const monthlyVarArr = unmappedDataset.[“monthlyVariance”];

1 Like

Hi @manjupillai16

I carried out your suggestion and it eliminated the error, but a new problem arises:

“unmappedDataset is not defined”

What could be wrong now, why isn’t the code fetching the required data from the url?

(I am using d3 versions 4.2.2 and 7.0.0 as I had a similar problem on a different project and using the 4.2.2 version made it work then, but not the case this time)

Thanks for your time


Solved it

Needed this code:

´ d3.json(‘url’).then(unmappedDataset => {

}); ´


Just checked the d3 versions you’re using.
There’s version 7.0 which needs the above d3.json(url).then()

and there’s also 4.2 but then the link has been repeated twice because of which the d3.json(url, function()) didn’t work earlier.
" "

But it’s always advisable to use the latest version.

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