Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trycf/bcc27bbde78c9c2da80555ca07145cf5 to your computer and use it in GitHub Desktop.
Save trycf/bcc27bbde78c9c2da80555ca07145cf5 to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
salesPeople = getSalesPeople();
theStars = salesPeople.map((row)=>{
var newRow = duplicate(row);
newRow["star"] = row.sales >= 10000
? "*"
: "";
return newRow;
});
writeDump({
" stars": theStars,
"original": salesPeople
});
function getSalesPeople(){
return [
{
id: 1,
firstName: "Susan",
lastName: "Lane",
email: "slane@gmail.com",
sales: 26540.43
},
{
id: 2,
firstName: "John",
lastName: "Doe",
email: "johndoe@example.com",
sales: 54120.64
},
{
id: 3,
firstName: "Mary",
lastName: "Smith",
email: "marysmith@example.com",
sales: 1540.78
}
];
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment