Closed
Bug 78144
Opened 24 years ago
Closed 24 years ago
zdnet.com - zdnet tells js developers to use true/false comparison functions for sort()
Categories
(Tech Evangelism Graveyard :: English US, defect, P1)
Tracking
(Not tracked)
VERIFIED
WONTFIX
People
(Reporter: jruderman, Assigned: bc)
References
()
Details
ZDNet tells me to use this function with sort():
function alphaDescending(a, b) {
return (a < b);
}
This function is incorrect because comparison functions are supposed to return
-1/0/1, not true/false. The function they give works in Netscape 4 and
sometimes works in IE, but it hasn't worked in Mozilla since Brendan checked in
the change in bug 64065 (it works in 2001 010310 Win98 but not in 2001 010504).
The correct function is:
function alphaDescending(a, b) {
return (a < b) ? 1 : -1;
}
Comment 1•24 years ago
|
||
return (a < b) ? 1 : -1;
It would help to return 0 for the case where a == b.
/be
| Assignee | ||
Updated•24 years ago
|
Priority: -- → P1
| Assignee | ||
Updated•24 years ago
|
Summary: zdnet tells js developers to use true/false comparison functions for sort() → zdnet.com - zdnet tells js developers to use true/false comparison functions for sort()
| Assignee | ||
Comment 2•24 years ago
|
||
Contacted zdnetcare@zdcommunity.com 7/6/01 about the sort function error as well
as improper browser sniffing etc. Marking assigned.
Status: NEW → ASSIGNED
| Assignee | ||
Comment 3•24 years ago
|
||
All Evangelism Bugs are now in the Product Tech Evangelism. See bug 86997 for
details.
Component: Evangelism → US English
Product: Browser → Tech Evangelism
Version: other → unspecified
| Assignee | ||
Comment 4•24 years ago
|
||
follow up with these sites by 0.9.5
Target Milestone: --- → mozilla0.9.5
| Assignee | ||
Comment 5•24 years ago
|
||
-> 0.9.6, need to follow up on these asap
Target Milestone: mozilla0.9.5 → mozilla0.9.6
| Assignee | ||
Comment 7•24 years ago
|
||
these guys will never fix this. -> wont fix
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → WONTFIX
Comment 8•24 years ago
|
||
Verified per instructions at http://mozilla-evangelism.bclary.com/evangelism.html
Status: RESOLVED → VERIFIED
Comment 9•22 years ago
|
||
Moving to new component
Component: Authors → English US
Target Milestone: Nov → ---
Updated•10 years ago
|
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•