HTML: Markup language
CSS: Styling language
JavaScript: Scripting language
Web APIs: Programming interfaces
All web technology
Learn web development
Discover our tools
Get to know MDN better
Cette page a été traduite à partir de l'anglais par la communauté. Vous pouvez contribuer en rejoignant la communauté francophone sur MDN Web Docs.
View in English Always switch to English
TypeError: argument is not a function object (Edge) TypeError: invalid Array.prototype.sort argument (Firefox)
TypeError
L'argument passé à Array.prototype.sort() devrait être undefined ou être une fonction comparant ses opérandes.
Array.prototype.sort()
undefined
[1, 3, 2].sort(5); // TypeError var cmp = { asc: (x, y) => x >= y, dsc: (x, y) => x <= y }; [1, 3, 2].sort(cmp[this.key] || "asc"); // TypeError
[1, 3, 2].sort(); // [1, 2, 3] var cmp = { asc: (x, y) => x >= y, dsc: (x, y) => x <= y }; [1, 3, 2].sort(cmp[this.key || "asc"]); // [1, 2, 3]