| Create | Read | Update | |
|---|---|---|---|
| Object.freeze() | ❌ | ✅ | ❌ |
| Object.seal() | ❌ | ✅ | ✅ |
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
| // Higher-Order Functions & Callback | |
| // ¹. A higher order function takes a function as a parameter. | |
| // ². A callback is a function (() => {...}) that is passed as an argument. | |
| const higherOrderFunction¹= (callback²) => { | |
| return callback(); | |
| } |
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
| // keyof | |
| // creates a type based on provided obkect keys | |
| type Lusophone = keyof {Brasil: 🇧🇷, Angola: 🇦🇴, "Cape Verde": 🇨🇻} // Lusophone = "Brasil" | "Angola" | "Cape Verde" |
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
| // Rebuilding Utility Types | |
| // T = Type; K = Keys; U = Union; | |
| // Nullable | |
| type MyNullable<T> = T | null; | |
| type MyNullableTest = MyNullable<🍓>; // MyNullableTest = 🍓 | null | |
| // Non-Nullable (filter != null | undefined) | |
| type MyNonNullable<T> = T extends null | undefined ? never : T; | |
| type MyNonNullableTest = MyNullable<🍊 | 🥝 | null | undefined> // MyNonNullableTest = 🍊 | 🥝 |
NewerOlder