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
| { | |
| "name": "Great Extension", | |
| "version": "1.0", | |
| "description": "Build an Extension with Angular", | |
| "manifest_version": 3 | |
| } |
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 GreetingParams { | |
| name?: string; // keep this for backward compatbility | |
| firstName?: string; // replaces name | |
| lastName?: { | |
| value: string; | |
| shouldComeFirst?: boolean; | |
| }; | |
| middleName?: string; | |
| prefix?: 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
| // Typescript | |
| interface GreetingParams { | |
| name?: string; // keep this for backward compatbility | |
| firstName?: string; // replaces name | |
| lastName?: string; | |
| lastNameFirst?: boolean; | |
| middleName?: string; | |
| prefix?: 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
| // Typescript | |
| interface GreetingParams { | |
| name?: string; // keep this for backward compatbility | |
| firstName?: string; // replaces name | |
| lastName?: string; | |
| lastNameFirst?: boolean; | |
| } | |
| function greet({ | |
| name, |
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
| // Typescript | |
| interface GreetingParams { | |
| name: string; | |
| } | |
| function greet({ name }: GreetingParams) { | |
| return `Hello, ${name}`; | |
| } | |
| // Javascript |
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
| // Name with prefix | |
| greet('John', undefined, false, undefined, 'Mr.'); | |
| // Name and last name with prefix | |
| greet('John', 'Doe', false, undefined, 'Mr.'); | |
| // Name and last name with prefix but last name first | |
| greet('John', 'Doe', true, undefined, 'Mr.'); | |
| // Finally just a name, a middle name and a last name | |
| greet('John', 'Doe', false, 'Christopher', 'Mr.'); |
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
| // Typescript | |
| function greet( | |
| firstName: string, | |
| lastName?: string, | |
| lastNameFirst: boolean = false, | |
| middleName?: string, | |
| prefix?: string, | |
| ): string { | |
| const greet: string = ''; | |
| // some implementation |
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
| // First name only - the old way | |
| greet('John'); | |
| // First name and last name | |
| greet('John', 'Doe'); | |
| // First name and last name but last name first :D | |
| greet('John', 'Doe', true); |
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
| // Typescript | |
| function greet(firstName: string, lastName?: string, lastNameFirst: boolean = false): string { | |
| if (!lastName) { | |
| return `Hello, ${firstName}`; | |
| } | |
| return `Hello ${lastNameFirst ? lastName + ' ' + firstName : firstName + ' ' + lastName}`; | |
| } | |
| // Javascript | |
| function greet(firstName, lastName, lastNameFirst = false) { |
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
| // Recieves a name and returns a greeting message | |
| // Typescript | |
| function greet(name: string): string { | |
| return `Hello, ${name}`; | |
| } | |
| // Javascript | |
| function greet(name) { | |
| return `Hello, ${name}`; | |
| } |