Created
March 6, 2023 14:44
-
-
Save ahmed025566/db276c3d1744f1d42b14e2fbbcb9c04d to your computer and use it in GitHub Desktop.
Is it DRY ?
This file contains hidden or 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 | |
| console.log(pets[0]); | |
| console.log(pets[1]); | |
| console.log(pets[2]); | |
| console.log(pets[3]); | |
| .... | |
| It is not DRY and here you can see how to make it DRY : | |
| pets.forEach((item) => console.log(item)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment