#temporaldeadzone — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #temporaldeadzone, aggregated by home.social.
-
typeof Works in Temporal Dead Zone?!
Temporal Dead Zone has a LOOPHOLE! typeof works on undeclared variables (returns undefined) but throws ReferenceError for let/const. This inconsistency is INSANE!
#javascript #javascripttricks #tdz #temporaldeadzone #typeof #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #variablehoisting #advancedjavascript
-
Temporal Dead Zone Breaks Code!
JavaScript's Temporal Dead Zone will crash your code! Accessing let/const before declaration throws an error. Watch the chaos!
#javascript #javascripttricks #codingtips #programmingtutorial #temporaldeadzone #javascriptquiz #codingchallenge #javascriptshorts #javascriptbugs #hoisting #javascriptwtf #letconst
-
I've been thinking about a couple topics recently and feel knowledgeable enough to write some non-bullshit content about them, so I'm curious if there's any interest on here for a #blog post on one or both of:
1. Writing optimizable #JavaScript libraries.
How bundlers work, how tree shaking and code splitting works, pure vs. impure code, top-level side effects, multiple entry points, `sideEffects`, common deoptimizations, etc.
2. #TemporalDeadZone - What is it, how you can identify it, why it's so tricky, and how to avoid it.
(You better believe #DBZ #GarlicJr is going to be the preview image for that one.)
Greatly appreciate any feedback!
-
I've been thinking about a couple topics recently and feel knowledgeable enough to write some non-bullshit content about them, so I'm curious if there's any interest on here for a #blog post on one or both of:
1. Writing optimizable #JavaScript libraries.
How bundlers work, how tree shaking and code splitting works, pure vs. impure code, top-level side effects, multiple entry points, `sideEffects`, common deoptimizations, etc.
2. #TemporalDeadZone - What is it, how you can identify it, why it's so tricky, and how to avoid it.
(You better believe #DBZ #GarlicJr is going to be the preview image for that one.)
Greatly appreciate any feedback!
-
I've been thinking about a couple topics recently and feel knowledgeable enough to write some non-bullshit content about them, so I'm curious if there's any interest on here for a #blog post on one or both of:
1. Writing optimizable #JavaScript libraries.
How bundlers work, how tree shaking and code splitting works, pure vs. impure code, top-level side effects, multiple entry points, `sideEffects`, common deoptimizations, etc.
2. #TemporalDeadZone - What is it, how you can identify it, why it's so tricky, and how to avoid it.
(You better believe #DBZ #GarlicJr is going to be the preview image for that one.)
Greatly appreciate any feedback!
-
I've been thinking about a couple topics recently and feel knowledgeable enough to write some non-bullshit content about them, so I'm curious if there's any interest on here for a #blog post on one or both of:
1. Writing optimizable #JavaScript libraries.
How bundlers work, how tree shaking and code splitting works, pure vs. impure code, top-level side effects, multiple entry points, `sideEffects`, common deoptimizations, etc.
2. #TemporalDeadZone - What is it, how you can identify it, why it's so tricky, and how to avoid it.
(You better believe #DBZ #GarlicJr is going to be the preview image for that one.)
Greatly appreciate any feedback!
-
I've been thinking about a couple topics recently and feel knowledgeable enough to write some non-bullshit content about them, so I'm curious if there's any interest on here for a #blog post on one or both of:
1. Writing optimizable #JavaScript libraries.
How bundlers work, how tree shaking and code splitting works, pure vs. impure code, top-level side effects, multiple entry points, `sideEffects`, common deoptimizations, etc.
2. #TemporalDeadZone - What is it, how you can identify it, why it's so tricky, and how to avoid it.
(You better believe #DBZ #GarlicJr is going to be the preview image for that one.)
Greatly appreciate any feedback!
-
#TIL #TypeScript allows enums to be used before they are declared.
```
// Compile error: `MyEnum` used before its declaration.
console.log(MyEnum.Foo);// Runtime error: Cannot read properties `Foo` of undefined.
console.log((() => MyEnum.Foo)());enum MyEnum {
Foo = 'foo',
}
```https://github.com/microsoft/TypeScript/issues/33204
I get that TS doesn't know `MyEnum.Foo` will be executed in the second case, but it also feels trivially fixable by just requiring enums to be declared before usage.
Alternatively TS could hoist the declaration, but I can understand not wanting to do that, especially given that enums can use other declared symbols as initializers.