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
| const greeting = (person: string) => { | |
| console.log('Good day ' + person); | |
| }; | |
| greeting('Daniel'); |
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
| var greeting = function (person) { | |
| console.log('Good day ' + person); | |
| }; | |
| greeting('Daniel'); |
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 isAwesome: boolean = 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
| let name: string = 'Chris'; | |
| let breed: string = 'Border Collie'; |
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 punchline: string = 'Because it was free-range.'; | |
| let joke: string = ` | |
| Q: Why did the chiken cross the road? | |
| A: ${punchline} | |
| `; |
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 decimalNumber: number = 42; | |
| let binaryNumber: number = 0b101010; // => 42 | |
| let octalNumber: number = 0o52; // => 42 | |
| let hexadecimalNumber: number = 0x2a; // => 42 |
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 myPetFamily: string[] = ['rocket', 'fluffly', 'harry']; |
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 myPetFamily: Array<string> = ['rocket', 'fluffly', 'harry']; |
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 myFavoriteTuple: [string, number, boolean]; | |
| myFavoriteTuple = ['chair', 20, true]; // ✅ | |
| myFavoriteTuple = [5, 20, true]; // ❌ - The first element should be a string, not a number |
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
| enum Sizes { | |
| Small, | |
| Medium, | |
| Large, | |
| } | |
| Sizes.Small; // => 0 | |
| Sizes.Medium; // => 1 | |
| Sizes.Large; // => 2 |