Calling something as a function when it is not callable.
This error occurs when you attempt to invoke something with `()` (call it like a function) but the value is not actually a function. JavaScript is flexible with types, so attempting to call a number, string, object, or `undefined` as a function results in this TypeError.
Common causes: shadowing a built-in function name with a variable, calling a method that doesn't exist on a type (returns `undefined`, then you call `undefined()`), misusing array methods by forgetting to call them with the right syntax, or trying to instantiate something that isn't a class.
1const result = [1, 2, 3, 4, 5];2 3// Typo: 'filter' misspelled as 'filtre'4const evens = result.filtre(n => n % 2 === 0);5console.log(evens);1const result = [1, 2, 3, 4, 5];2 3// Fix: Use the correct method name 'filter'4const evens = result.filter(n => n % 2 === 0);5console.log(evens); // [2, 4]6 7// Another common pattern: make sure callback is a function8function processData(data, callback) {9 if (typeof callback !== 'function') {10 throw new TypeError('callback must be a function');11 }12 return callback(data);13}14 15processData([1, 2, 3], arr => arr.map(x => x * 2)); // [2, 4, 6]Simulate standard system builds to trigger compiler trace records and track memory crashes locally.
`Array.prototype.filtre` does not exist, so `result.filtre` evaluates to `undefined`. Calling `undefined(...)` with arguments throws `TypeError: result.filtre is not a function`. This follows the pattern of accessing a non-existent method and then trying to invoke the `undefined` result.