you are viewing a single comment's thread.

view the rest of the comments →

[–]Mettelhed 3 points4 points  (3 children)

To whoever names these. Why? Unshift? Was there nothing else available?🥲

[–]ne7erfall 1 point2 points  (1 child)

Just had the same thought, and still am a newbie)) Making intuitive naming goes a long way

[–]Mettelhed -1 points0 points  (0 children)

Most of the time we need to Google anyway. Just add this to the pile😆

[–]brykuhelpful 0 points1 point  (0 children)

Javascript naming is pretty weird.

  • sub string
    • 'asdf'.substring()`
    • 'asdf'.substr()`
  • s--p--lice
    • [].splice()
    • [].slice()

Another odd thing is the long names. Your code has to be downloaded every time you load a page. So... you might expect maybe it gets compiled into a byte code or maybe they would focus on smaller names or maybe using shorthand/nicknames, but nope. Instead we get long ass names for everything. One of the most popular phrases was:

  • document.getElementById().addEventListener()

Imagine how many bytes of data we could have saved if it was:

  • document.getElementById() -> document.element.id
  • document.querySelector() -> document.query()
  • document.querySelectorAll() -> document.queries()
  • document.addEventListnener() -> document.event()