@@ -341,13 +341,13 @@ function emailClients(clients) {
341341
342342** Good:**
343343``` javascript
344- function emailClients (clients ) {
344+ function emailActiveClients (clients ) {
345345 clients
346- .filter (isClientActive )
346+ .filter (isActiveClient )
347347 .forEach (email);
348348}
349349
350- function isClientActive (client ) {
350+ function isActiveClient (client ) {
351351 const clientRecord = database .lookup (client);
352352 return clientRecord .isActive ();
353353}
@@ -532,10 +532,14 @@ function showEmployeeList(employees) {
532532 const expectedSalary = employee .calculateExpectedSalary ();
533533 const experience = employee .getExperience ();
534534
535- let portfolio = employee .getGithubLink ();
536- 537- if (employee .type === ' manager' ) {
538- portfolio = employee .getMBAProjects ();
535+ let portfolio;
536+ switch (employee .type ) {
537+ case ' manager' :
538+ portfolio = employee .getMBAProjects ();
539+ break ;
540+ case ' developer' :
541+ portfolio = employee .getGithubLink ();
542+ break ;
539543 }
540544
541545 const data = {
@@ -732,7 +736,7 @@ holding onto a reference of the shopping cart will be affected by any changes.
732736
733737Two caveats to mention to this approach:
734738 1 . There might be cases where you actually want to modify the input object,
735- but when you adopt this programming practice you will find that those case
739+ but when you adopt this programming practice you will find that those cases
736740are pretty rare. Most things can be refactored to have no side effects!
737741
738742 2 . Cloning big objects can be very expensive in terms of performance. Luckily,
0 commit comments