home.social

#destructuring — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #destructuring, aggregated by home.social.

  1. You Can Use Same Variable Name TWICE?!

    🔥 NO WAY! Destructuring allows DUPLICATE variable names in the same statement! const {a, a} = obj is VALID JavaScript! Last one silently wins. ESLint doesn't catch this by default. Tag a dev who needs to see this!

    #javascript #javascripttricks #codingchallenge #destructuring #javascriptes6 #javascriptquiz #javascriptweird #javascriptwtf #javascriptbugs #codinginterview #codingtips #javascriptshorts

    youtube.com/watch?v=1fs8zval7Hk

  2. I'm sure there's some technical reason it can't be done, but I really want to be able to wrap destructured variables with functions.

    instead of:
    ```
    const { prop, otherProp } = object;
    const propAsNumber = parseInt(prop);
    ```

    I want to do:
    ```
    const { parseInt(prop), otherProp } = object;
    ```

    #javaScript #webDev #frontend #backend #fullstack #nodejs #ecmascript #destructuring #es6

  3. I found the `zeallot` package for destructuring/unpacking assignments in #Rstats. I'm familiar w/ #destructuring in JS and Python, had not really wondered about it in R until recently... how did I not know this existed?

    github.com/r-lib/zeallot

    Is this package the only implementation of destructuring in R? Is there an obvious implementation I just don't know about --- maybe something hiding in the #tidyverse?