Created
November 18, 2024 13:12
-
-
Save trycf/d9671ebff00c830eac8a9af5d08f366a 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); | |
r = arraySort( | |
SomeArray, | |
function (e1, e2){ | |
echo("#e1.age# lt #e2.age# " & (e1.age lt e2.age) & "<br>"); | |
echo("#e1.age# gt #e2.age# " & (e1.age gt e2.age) & "<br>"); | |
return e1.age gt e2.age; | |
} | |
); | |
dump(r); | |
dump(SomeArray); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment