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 Greeter { | |
| constructor(message) { | |
| this.greeting = message; | |
| } | |
| greet() { | |
| return "Hello, " + this.greeting; | |
| } | |
| } |
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 Greeter { | |
| greeting: string; | |
| constructor(message: string) { | |
| this.greeting = message; | |
| } | |
| greet() { | |
| return "Hello, " + this.greeting; | |
| } |
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 greeter(person) { | |
| return "Hello, " + person.firstName + " " + person.lastName; | |
| } |
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 greeter(person) { | |
| if (!person || !person.firstName || !person.lastName) { | |
| throw new Error('invalid arguments'); | |
| } | |
| return "Hello, " + person.firstName + " " + person.lastName; | |
| } | |
| // Jasmine spec: | |
| describe("greeter", function() { |
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
| interface Person { | |
| firstName: string; | |
| lastName: string; | |
| } | |
| function greeter(person: Person): string { | |
| return "Hello, " + person.firstName + " " + person.lastName; | |
| } | |
| // Jasmine spec: |
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
| let user = { firstName: "James", lastName: "Hetfield" }; | |
| console.log(greeter(user)); |
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
| declare function camelize(s: string): string; |
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
| npm install --save-dev @types/jasmine |
OlderNewer