Created
March 5, 2019 01:37
-
-
Save MeetMartin/ae2d9a5c653038411af2f79cb7052e4f 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
class TextTransformation { | |
constructor(text) { | |
this.text = text; | |
} | |
makeImportant() { | |
this.text = this.text.trim(); // trim | |
this.text = this.text.toLowerCase(); // make lowercase | |
this.text = this.text.charAt(0).toUpperCase() + this.text.slice(1); // capitalize | |
this.text = this.text + '!'; // add ! | |
return this.text; | |
} | |
makeUnimportant() { | |
this.text = this.text.trim(); // trim | |
this.text = this.text.toLowerCase(); // make lowercase | |
this.text = this.text + '.'; // add . | |
return this.text; | |
} | |
} | |
export default TextTransformation; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment