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)

x86
Windows 98
defect

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; }
return (a < b) ? 1 : -1; It would help to return 0 for the case where a == b. /be
Priority: -- → P1
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()
Contacted zdnetcare@zdcommunity.com 7/6/01 about the sort function error as well as improper browser sniffing etc. Marking assigned.
Status: NEW → ASSIGNED
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
follow up with these sites by 0.9.5
Target Milestone: --- → mozilla0.9.5
-> 0.9.6, need to follow up on these asap
Target Milestone: mozilla0.9.5 → mozilla0.9.6
-> authors
Component: US General → Authors
these guys will never fix this. -> wont fix
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → WONTFIX
Status: RESOLVED → VERIFIED
Moving to new component
Component: Authors → English US
Target Milestone: Nov → ---
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in before you can comment on or make changes to this bug.