Skip to content

Instantly share code, notes, and snippets.

@arthurborgesdev
Created July 19, 2021 16:59
Show Gist options
  • Save arthurborgesdev/fcebd839207a0fe6fbddaf4f5c215486 to your computer and use it in GitHub Desktop.
Save arthurborgesdev/fcebd839207a0fe6fbddaf4f5c215486 to your computer and use it in GitHub Desktop.
Is it DRY? Example 1
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;
}
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