bobbyache

TypeScript - Getter and Setter Properties

Sep 27th, 2019
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. get fileNameWithoutExt(): string {
  2. return this.fileName.substring(0, this.fileName.lastIndexOf('.'));
  3. }
  4.  
  5. class foo {
  6. private _bar:boolean = false;
  7.  
  8. get bar():boolean {
  9. return this._bar;
  10. }
  11. set bar(theBar:boolean) {
  12. this._bar = theBar;
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment