Skip to content

Errors / JavaScript errors

Uncaught TypeError: x is not a function

A script tried to use something as an action that is not one, and stopped.

The feature that calls it does nothing when used: a slider that never moves, a list that never renders.

Why it happens

  • Two versions of a library on one page, or a plugin loaded before the library it extends: $(…).slick is not a function is a jQuery plugin missing from the jQuery that ran.
  • A typo or a renamed method after an upgrade.
  • Calling an array method on something that is not an array: data.map is not a function when the API answered an object or an error.
  • A variable reused: a function name overwritten by a value somewhere else.

How to fix it

  1. Log the thing before the dot and check what it really is (console.log(typeof data, data)).
  2. For plugins, load the library once, then its plugins, in that order; look for a second copy of jQuery added by a theme or a plugin.
  3. For API data, check the response shape before calling array methods on it.

Whose problem it is

Either the site's own code or a third party's, depending on where it comes from.

Does your site have it?

Free, no account. We open your page and four more in a clean Chrome and list every error like this one, with the page and the click that caused it. How the free page check works.

Check only sites you run or have permission to check.

Often seen with