Get to know MDN better
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value is not actually a function.
It attempted to call a value from a function, but the value is not actually a function. Some code expects you to provide a function, but that didn't happen.
Maybe there is a typo in the function name? Maybe the object you are calling the method on does not have this function? For example, JavaScript Objects have no map function, but the JavaScript Array object does.
There are many built-in functions in need of a (callback) function. You will have to provide a function in order to have these methods working properly:
When working with Array or TypedArray objects:
In this case, which happens way too often, there is a typo in the method name:
The correct function name is getElementById:
For certain methods, you have to provide a (callback) function and it will work on specific objects only. In this example, Array.prototype.map() is used, which will work with Array objects only.
Use an array instead:
Sometimes when making a class, you may have a property and a function with the same name. Upon calling the function, the compiler thinks that the function ceases to exist.
Use a different property name instead:
In math, you can write 2 × (3 + 5) as 2*(3 + 5) or just 2(3 + 5).
Using the latter will throw an error:
You can correct the code by adding a * operator:
Ensure you are importing the module correctly.
An example helpers library (helpers.js)
The correct import usage (App.js):
This page was last modified on Jul 8, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.