Skip to content

Instantly share code, notes, and snippets.

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