Last active
January 13, 2020 15:13
-
-
Save rsmelo92/e172b985fbc8f1a79cd8c9f869e06165 to your computer and use it in GitHub Desktop.
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
// *SMELL* | |
function mutableData() { | |
let name = { | |
firstName: "Rafael", | |
lastName: "Melo" | |
}; | |
name = `${name.firstName} ${name.lastName}`; | |
return name; | |
} | |
// *REFACTORED* | |
function nonMutableData() { | |
const name = { | |
firstName: "Rafael", | |
lastName: "Melo" | |
}; | |
const fullName = `${name.firstName} ${name.lastName}`; | |
return fullName; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment