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 CustomDate { | |
// ... | |
static epoch = new CustomDate(0); | |
} | |
/* or */ | |
class CustomDate { | |
// ... | |
} |
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 x = Number.MAX_SAFE_INTEGER; | |
// ↪ 9007199254740991, this is 1 less than 2^53 | |
const y = x + 1; | |
// ↪ 9007199254740992, ok, checks out | |
const z = x + 2 | |
// ↪ 9007199254740992, wait, that’s the same as above! |
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 theBiggestInt = 9007199254740991n; | |
const alsoHuge = BigInt(9007199254740991); | |
// ↪ 9007199254740991n | |
const hugeButString = BigInt('9007199254740991'); | |
// ↪ 9007199254740991n |
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 x = Number.MAX_SAFE_INTEGER; | |
// ↪ 9007199254740991, this is 1 less than 2^53 | |
const y = x + 1; | |
// ↪ 9007199254740992, ok, checks out | |
const z = x + 2 | |
// ↪ 9007199254740992, wait, that’s the same as above! |
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 response = { | |
settings: { | |
nullValue: null, | |
height: 400, | |
animationDuration: 0, | |
headerText: '', | |
showSplashScreen: 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
// Potentially unintended. '' is falsy, result: 'Hello, world!' | |
const headerText = response.settings.headerText || 'Hello, world!'; | |
// Potentially unintended. 0 is falsy, result: 300 | |
const animationDuration = response.settings.animationDuration || 300; | |
// Potentially unintended. false is falsy, result: true | |
const showSplashScreen = response.settings.showSplashScreen || 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
const response = { | |
settings: { | |
nullValue: null, | |
height: 400, | |
animationDuration: 0, | |
headerText: '', | |
showSplashScreen: 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
obj?.prop // optional static property access | |
obj?.[expr] // optional dynamic property access | |
func?.(...args) // optional function or method call |
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
iterator.return?.() // manually close an iterator |
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
data?.map(item => <div>{item}<div> |