Here, you’ll find tips posted daily relating to JavaScript: its features, how its used, and anything else related to the language and developing with it.
Tips
Latest
- ES2021 Preview
- Async Generators
- The Long Arrow Operator
- Default Parameter Scope
- Undefined vs. Null vs. Nullish
Language Features
- Optional Chaining
- Nullish Coalescing Operator
- Default Function Parameters
- Reduce Code with Destructuring
- Variables in Strings with Template Literals
- Symbols for Safe Property Names
- Reduce Code with Object Shorthand Syntax
- Declarations let, const and class Can’t be Redeclared
- typeof null === “object”
- Symbol.toStringTag
- Spreading Values
- Numeric Literal Formats
- Async Functions and await
- with Statements
- Accessor Properties (Getter/Setter)
- super in Object Literals
- Property Descriptors
- Default Parameters with Destructuring
- Symbol.species
- Proxy Objects
- Flattening Arrays
- globalThis
- Computed Properties
- Symbol.hasInstance
- Preventing Extensions in Objects
- What is a NaN?
- __proto__ in Object Literals
- Sealing Objects
- Negative Zero
- Freezing Objects
- Object Serialization With JSON
- Labels
- Custom Serialization With toJSON
- Trailing Commas
- JSON Reviver Function
- Function Name Bindings
- ES2021 Preview
Web API
- Detecting Dark Mode
- Event Attributes also Define Callback Functions
- addEventListener Options
- fetch is the new XMLHttpRequest
- setTimeout Callback Arguments
- Scrolling an Element into View
- Event Attribute Scopes
- Finding Elements in the DOM
- Live DOM Lists
- Easily Toggle HTML Classes
- Setting HTML Element Styles
- Entering Fullscreen
- The Window Proxy
- HTML ids Are Global
- Animations With requestAnimationFrame
- MutationObserver
- Canvas for Bitmaps
Classes/Constructors
- Overriding Constructor Returns
- super() Defines this
- New Functions With new
- Not All Functions Are Constructors
- Constructors Don’t Need Parens
- The Deal With Prototypes
- Static Members Are Inherited
- When the constructor Property Matters
- Constructor Internals
- A Function’s Home Object
- Mixing class and function Constructors
Generators and Iterators
- Generators for Iterables
- Create Iterable Objects
- Generating Ranges
- The Iterator Protocol
- Interacting With Generators
- Yield Many With yield*
- Generator Prototypes
- Using Generators to Animate
- Object.keys vs Array.keys
- Async Generators
How Tos
- Is it an Array?
- Format Time Strings with Padding
- Chaining
- Using Destructuring to Swap Values
- A Custom Self-rejecting Promise
- Filter and Map With flatMap
- Mixins
- Time-based requestAnimationFrame
- Copying Accessor Properties
Miscellaneous
- Thenable Objects
- Internal Slots
- Missing Semicolon ASI Gotchas
- Hoisting
- The Return of ASI
- Exotic Objects
- Array-likes
- Define vs. Assign
- What Uses enumerable?
- Variable Shadowing
- Awaiting Non-promises
- Global Object vs. Global Declarations
- Promises Block Rendering
- Parameters are Reference Variables
- Kinds of Comparisons
- The Underscore Convention
- String Conversions in Depth
- Closure Scopes Limit Closure Variables
- Prototypes as Instance of Type
- Undefined vs. Null vs. Nullish
- Default Parameter Scope
- The Long Arrow Operator
Tooling
- JavaScript with Types: TypeScript
- JavaScript Outside the Browser: Node
- Expandable Logs With console.dir
- Detect Errors Early With Linting
- Stylish Logs
- JSFuck
- Console $ Utilities
- The debugger Statement