Timeline for Sort array of objects by string property value
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 22, 2018 at 17:07 | comment | added | Chris22 |
@BadFeelingAboutThis thanks, for the explanation and the link. Believe it or not, I googled various snippets of code using the 1, 0, -1 before I asked this here. I just wasn't finding the info I needed.
|
|
| Aug 22, 2018 at 16:54 | comment | added | BadFeelingAboutThis |
@Chris22 a negative number returned means that b should come after a in the array. If a positive number is returned, it means a should come after b. If 0 is returned, it means they are considered equal. You can always read the documentation: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
|
|
| Aug 22, 2018 at 6:15 | comment | added | Chris22 | @BadFeelingAboutThis what does returning either -1 or 1 mean? I understand that -1 literally means that A is less than B just by the syntax, but why use a 1 or -1? I see everyone is using those numbers as return values, but why? Thanks. | |
| Apr 29, 2014 at 18:35 | history | edited | BadFeelingAboutThis | CC BY-SA 3.0 |
Missing closing bracket and line termination
|
| Jul 15, 2009 at 4:03 | history | answered | kennebec | CC BY-SA 2.5 |