Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. /**
  2. * @name Function with too many parameters
  3. * @description Functions with many parameters are hard to read and hard to use.
  4. */
  5.  
  6. function sendRecord(firstName, lastName, dateOfBirth, streetAddress, postCode, city, country, email, website) {
  7. sendResponse({
  8. name: lastName + ', ' + firstName,
  9. DOB: dateOfBirth,
  10. address: streetAddress + '\n' + postCode + ' ' + city + '\n' + country,
  11. email: email,
  12. url: website
  13. });
  14. }
  15.  
  16.  
  17. //better
  18. function sendRecord(record) {
  19. sendResponse({
  20. name: record.lastName + ', ' + record.firstName,
  21. DOB: record.dateOfBirth,
  22. address: record.streetAddress + '\n'
  23. + record.postCode + ' ' + record.city + '\n'
  24. + record.country,
  25. email: record.email,
  26. url: record.website
  27. });
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement