Skip to content

Instantly share code, notes, and snippets.

@behnamazimi
Created March 4, 2019 07:12
Show Gist options
  • Save behnamazimi/14a3fc27f811576aa94a5ef8823f1ef6 to your computer and use it in GitHub Desktop.
Save behnamazimi/14a3fc27f811576aa94a5ef8823f1ef6 to your computer and use it in GitHub Desktop.
Clean Code Not West Your Time
// 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