Last active
August 29, 2015 14:02
-
-
Save heymichaelp/6dabe0f93b2e3302d0d8 to your computer and use it in GitHub Desktop.
Value Objects: Example of Functional approach
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
Grade.equal = function(grade1, grade2) { | |
return grade1.valueOf() === grade2.valueOf(); | |
} | |
var myFirstGrade = new Grade(0.7); | |
var mySecondGrade = new Grade(0.7); | |
Grade.equal(myFirstGrade, mySecondGrade) // => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment