Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trycf/d9671ebff00c830eac8a9af5d08f366a to your computer and use it in GitHub Desktop.
Save trycf/d9671ebff00c830eac8a9af5d08f366a to your computer and use it in GitHub Desktop.
TryCF Gist
<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