[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Errors/Not_a_function [Back]  [Original]

TypeError: "x" is not a function - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

TypeError: "x" is not a function

TypeError: "x" is not a function

In this article

TypeError.

?

, . , , .

, ? , , , ? , JavaScript map , JavaScript Array - .

, -. - , :

, , :

js
var x = document.getElementByID("foo");
// TypeError: document.getElementByID is not a function

- getElementById:

js
var x = document.getElementById("foo");

-, . Array.prototype.map(), Array .

js
var obj = { a: 13, b: 37, c: 42 };

obj.map(function (num) {
  return num * 2;
});

// TypeError: obj.map is not a function

:

js
var numbers = [1, 4, 9];

numbers.map(function (num) {
  return num * 2;
});

// Array [ 2, 8, 18 ]


Web Proxy Viewer  |  New URL  |  Original Page