Last active
April 8, 2019 14:42
-
-
Save quisido/9d9171d13ef2fbf1076c8ec61ada4c5b to your computer and use it in GitHub Desktop.
Variable length currying in JavaScript
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
const myStrObject = { | |
toString: function() { | |
return 'Str'; | |
} | |
}; | |
console.log('My object is ' + myStrObject); // 'My object is Str' | |
console.log(myStrObject + 297); // 'Str297' | |
const myNumObject = { | |
valueOf: function() { | |
return 123; | |
} | |
}; | |
console.log('My object is ' + myNumObject); // 'My object is 123' | |
console.log(myNumObject + 297); // 420 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment