8

The document.getElementbyId function . It is so long.

Aldo this probably poes not count but the export function does not accespt whitespace before and after the = sign
So instead of
export PATH = "$PATH:/foo/bar/baz"

You need to write
export PATH="$PATH:/foo/bar/baz"

Comments
  • 1
    document.querySelector() for all purposes, don't cry over unnecessary things
  • 0
    @theabbie Sorry I somehow didn't know about it's existence
  • 3
    @Sony-wf-1000xm3
    Nana.... getElementById does one thing.

    querySelector is pretty much everything.

    And I like the name. ;)

    To the bash part: Yeah.

    Want to know why?
  • 1
    It's less long id your editor auto completes ;)
  • 5
    You could just assign it to a variable.

    var ID = document.getElementById;

    Then you can just write

    ID(“myid”)

    I used to do something similar long before jquery came around, bug I actually used the $ sign just like jquery did, stole that idea from some code example I found.
  • 1
    @Voxera sometimes that creates errors related to this's context so it's best to use

    @highlight
    const wrapper = (...args)=>target_function(...args);
  • 3
  • 1
    @melezorus34 that was not something I thought much about 20 years ago ;)

    But in this case it should no be a problem since we are calling a dom method and returning an object.
    As far as I know document.getElementById does not use this so it should be safe.

    If we did this for a method we created this could be a problem yes.
Add Comment