Last active
February 14, 2017 06:25
-
-
Save casprwang/82e342330b663df981dff9c33ecc6e6f to your computer and use it in GitHub Desktop.
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
function higher (d) ({ | |
add3: () => (d + 3) | |
}) | |
const higher = (d) => ({ | |
add3: () => d + 3 | |
}) | |
class higher { | |
constructor (d) { | |
this.d = d | |
} | |
add3 () { | |
return this.d + 3 | |
} | |
} | |
const c = new higher(3) | |
// console.log(typeof(higher)) | |
console.log(c.add3()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Two way to declare a class(function)