Created
March 4, 2019 07:12
-
-
Save behnamazimi/14a3fc27f811576aa94a5ef8823f1ef6 to your computer and use it in GitHub Desktop.
Clean Code Not West Your Time
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
// Clean Code Not West Your Time | |
// It's hard to learn new things like ES6/5 | |
// and use it's features in code | |
// Dirty Codes | |
const myArray = [obj1, obj2, obj3, ..., objn] // your static array | |
const myNewArray = myArray.foreEach(function(elm){ | |
elm.value = elm.value + "new value" | |
}) | |
// Clean Code | |
const myArray = dataStorage.getMyArray() | |
const myNewArray = myArray.map(elm=>{ | |
elm.value += "new value" | |
}) | |
// in this example maybe it seems difficult to you to add new file | |
// for your statis arrays and constants but in long time it will save | |
// your time, money and also your mind! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment