Created
November 18, 2024 13:09
-
-
Save trycf/5083914dd0eb1203f7d1475886f4c96f to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
runs = [ | |
{ totalDuration: 10}, | |
{ totalDuration: 20}, | |
{ totalDuration: 30} | |
]; | |
dump(runs); | |
arraySort( | |
runs, | |
function (e1, e2){ | |
return e1.totalDuration lt e2.totalDuration; | |
} | |
); | |
dump(runs); | |
SomeArray = [ | |
{name="testemployee", age="32"}, | |
{name="employeetest", age="36"} | |
]; | |
dump(SomeArray); | |
arraySort( | |
SomeArray, | |
function (e1, e2){ | |
return compare(e1.age, e2.age); | |
} | |
); | |
dump(SomeArray); | |
// member function with closure | |
SomeArray.sort( | |
function (e1, e2){ | |
return compare(e1.age, e2.age); | |
} | |
); | |
dump(SomeArray); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment