UI Design Example

    Loom

    JavaScript Bytes

    JavaScript Bytes

    Core JavaScript concepts every developer should know

    Frontend
    9 bytes available2 minutes each
    2 min
    10 claps

    var vs. let vs. const

    Learn about their unique scoping rules (function-scoped vs. block-scoped), redeclaration and reassignment behaviors, and hoisting nuances, including the Temporal Dead Zone. Master these fundamental concepts to write cleaner, more predictable, and robust JavaScript code.

    BEGINNER
    Quick read
    2 min
    15 claps

    Hoisting in JavaScript

    Hoisting is JavaScript's behavior of moving variable and function declarations to the top of their scope during compilation.

    INTERMEDIATE
    Quick read
    2 min
    14 claps

    Closures in JavaScript

    Discover how functions can "remember" and access variables from their outer scope, even after that scope has closed. This byte simplifies closures with real-world examples, showing how they enable powerful patterns like data privacy, function factories, and maintaining state in async operations

    ADVANCED
    Quick read
    2 min
    14 claps

    Deep Copy vs. Shallow Copy

    Shallow copies share nested data, so changes in one reflect in the other. Deep copies create independent duplicates. Object.assign makes shallow copies of nested objects, while structuredClone ensures a true deep copy. Essential for avoiding unexpected side effects!

    INTERMEDIATE
    Quick read
    2 min
    9 claps

    Why 0.1 + 0.2 ≠ 0.3 in JavaScript

    Why? JavaScript can't store decimal numbers exactly. It's like trying to write 1/3 as a decimal - you get 0.333333... forever. JavaScript stores 0.1 as something like 0.10000000000000001. The Cheat Code: Never use === for decimal comparisons. Use tolerance checking instead: Math.abs(a - b) < 0.0001.

    INTERMEDIATE
    Quick read
    2 min
    5 claps

    JavaScript Proxy Objects

    Think of it as a security guard for your objects! Proxy lets you intercept and customize operations (get, set, delete) performed on objects. Want to hide sensitive data? Validate inputs? Proxy is your friend!

    INTERMEDIATE
    Quick read
    2 min
    10 claps

    Object.groupBy() - Array Method

    Discover Object.groupBy, a new built-in JavaScript method (ES2024) that simplifies data grouping. Say goodbye to complex reduce function implementations for grouping elements. This byte demonstrates how Object.groupBy provides a clean, straightforward way to organize data based on specified criteria

    BEGINNER
    Quick read
    2 min
    5 claps

    Data Types in JavaScript

    Learn the difference between primitive types (like numbers, strings, booleans) and non-primitive types (objects, arrays, functions). Understand how JavaScript handles different kinds of data, which is crucial for writing effective and error-free code.

    BEGINNER
    Quick read
    2 min
    10 claps

    Event Loop in JavaScript

    Discover how this clever mechanism allows single-threaded JavaScript to handle asynchronous operations (like fetching data or timers) without freezing your browser. Learn about the Call Stack, Web APIs, and Callback Queue, and how they work together to keep your applications responsive and smooth.

    INTERMEDIATE
    Quick read