-
-
Save arthurborgesdev/fcebd839207a0fe6fbddaf4f5c215486 to your computer and use it in GitHub Desktop.
Is it DRY? Example 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pets = ['Cat', 'Dog', 'Bird', 'Fish', 'Frog', 'Hamster', 'Pig', 'Horse' 'Lion', 'Dragon']; | |
// Print all pets | |
pets.forEach(pet => console.log(pet)) | |
... | |
.animal { | |
font-family: "Times New Roman", Times, serif; | |
font-size: 1rem; | |
} | |
animal.cat { | |
color: #FFF; | |
} | |
animal.dog { | |
color: #000; | |
} | |
animal.dragon { | |
color: #009933; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It is DRY because the function is succint, working for every example provided (every funciton call). Also the CSS code has its rules separated and organized for each greeting. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment