Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <cfscript>
  2. salesPeople = getSalesPeople();
  3.  
  4. theStars = salesPeople.map((row)=>{
  5. var newRow = duplicate(row);
  6. newRow["star"] = row.sales >= 10000
  7. ? "*"
  8. : "";
  9. return newRow;
  10. });
  11.  
  12. writeDump({
  13. " stars": theStars,
  14. "original": salesPeople
  15. });
  16.  
  17.  
  18.  
  19. function getSalesPeople(){
  20. return [
  21. {
  22. id: 1,
  23. firstName: "Susan",
  24. lastName: "Lane",
  25. email: "slane@gmail.com",
  26. sales: 26540.43
  27. },
  28. {
  29. id: 2,
  30. firstName: "John",
  31. lastName: "Doe",
  32. email: "johndoe@example.com",
  33. sales: 54120.64
  34. },
  35. {
  36. id: 3,
  37. firstName: "Mary",
  38. lastName: "Smith",
  39. email: "marysmith@example.com",
  40. sales: 1540.78
  41. }
  42. ];
  43. }
  44. </cfscript>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement