[1, 2].sort({})
has unhelpful error message
#2411
Labels
Milestone
[1, 2].sort({})
has unhelpful error message
#2411
[1, 2].sort(true)
and[1, 2].sort({})
throw a TypeError with themessage
"Array.prototype.sort: argument is not a JavaScript object".This is unhelpful for
true
, and incorrect for{}
. A better error message would perhaps be, `Array.prototype.sort: comparefn argument must be a function or undefined".(discovered while looking into tc39/ecma262#785)
The text was updated successfully, but these errors were encountered: