Last active
September 10, 2018 14:14
유지보수가 쉬운 코드
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
class Gear { | |
constructor(readonly chainring: number, readonly cog: number) {} | |
ratio() { | |
return this.chainring / this.cog; | |
} | |
} |
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
class Gear { | |
constructor(private _chainring: number, private _cog: number) {} | |
get chainring() { | |
return this._chainring; | |
} | |
get cog() { | |
return this._cog; | |
} | |
ratio() { | |
return this.chainring / this.cog; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment