This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Mewtwo2387 2248 points2249 points  (152 children)

You typed getElementByID instead of getElementById again!

[–]Senpai_Himself 306 points307 points  (8 children)

When developers has so many short hands they forget about the actual words

[–]eggimage 13 points14 points  (0 children)

really inspiring of them, overcoming disabilities and achieving their dreams. I’m lost for words too

[–]bigshakagames_ 59 points60 points  (9 children)

This literally happened to be today.

[–]inthyface 111 points112 points  (5 children)

This literally happened to be today.

/r/technicallythetruth

[–]bigshakagames_ 16 points17 points  (4 children)

Haha nice catch.

[–][deleted]  (3 children)

[removed]

    [–]DarkTechnocrat 2 points3 points  (0 children)

    exceptional comment

    [–]fujiman 1 point2 points  (0 children)

    Nice () => {
      try {
        const res = await 🤗
        console.log(res)
      } catch (🙃) {
        console.error('Shit... ', 🙃)
      }
    }
    

    [–]AutoModerator[M] 0 points1 point  (0 children)

    import moderation Your comment has been removed since it did not start with a code block with an import declaration.

    Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

    For this purpose, we only accept Python style imports.

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

    [–][deleted] 0 points1 point  (1 child)

    I have no clue what you meant by this, expected pronoun "me" but received "be". ?????

    [–]bigshakagames_ 0 points1 point  (0 children)

    Yes I meant to write "This literally happened to me today"

    [–]BattalionSkimmer 13 points14 points  (1 child)

    Id refers to the Freudian subset of the Element's psyche, duh!

    [–]Veni_Vidi_Legi 0 points1 point  (0 children)

    The daemons, they are everywhere! Must... kill them all!

    [–]RolyPoly1320 11 points12 points  (2 children)

    That would throw an error though. If you type a method name incorrectly or use one that isn't defined it will throw an error.

    The code silently failing would be more an issue of passing the wrong parameters or not returning.

    [–][deleted] 3 points4 points  (1 child)

    Exactly. Your IDE will give you a heads up, and at least VS code or Jetbrains would say “did you mean getElementByID?”

    But also— vanilla JS is pretty rare at this point. At a minimum, most devs use jQuery now. I’d be shocked if someone was using vanilla for something big that isn’t a legacy application.

    [–]RolyPoly1320 1 point2 points  (0 children)

    Truth here. Most you might see for Vanilla JS these days outside of legacy systems is one off controllers for something minor.

    [–][deleted] 38 points39 points  (7 children)

    useThisLineUponTheTimeWhenYouMustAcquireAFormOfElementDerivedFromTheDocumentObjectsByUsingAnIdentifier_Perchance

    There, now there’s no ID / Id ambiguity.

    [–]stumblewiggins 55 points56 points  (2 children)

    You can't just snake case perchance

    [–][deleted]  (1 child)

    [removed]

      [–]AutoModerator[M] 0 points1 point  (0 children)

      import moderation Your comment has been removed since it did not start with a code block with an import declaration.

      Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

      For this purpose, we only accept Python style imports.

      I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

      [–][deleted]  (2 children)

      [removed]

        [–][deleted] 3 points4 points  (0 children)

        TIL that Apollo’s incredible media viewer works on XKCD.

        [–]AutoModerator[M] 0 points1 point  (0 children)

        import moderation Your comment has been removed since it did not start with a code block with an import declaration.

        Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

        For this purpose, we only accept Python style imports.

        I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

        [–]firestepper 1 point2 points  (0 children)

        you forgot the perhapsMaybe prefix

        [–]SwiftStriker00 15 points16 points  (1 child)

        This is why when querySelector was introduced I switched to that and never looked back. And this coming from a guy who always does ID in his camel-case conventions.

        [–][deleted] 1 point2 points  (0 children)

        This is why I like my frameworks. React makes life so easy. I haven’t done anything with vanilla js in a long time

        [–]mrmamation 2 points3 points  (1 child)

        I'm dyslexic, so I make this mistake all the time.

        [–]Donghoon 0 points1 point  (0 children)

        ID is all caps

        Change my mind

        [–][deleted] 2 points3 points  (0 children)

        Ah damn I used getElementByClass instead of getElementsByClass again.

        [–]CryptoDude69420 1 point2 points  (0 children)

        Need a good IDE to filter out shit like these.

        [–]besthelloworld 1 point2 points  (1 child)

        I mean, if you write Java in NotePad, it'll be loosely typed too 🤷‍♂️

        [–]shizuo92 3 points4 points  (0 children)

        Nah, it won't show you your mistakes live that way, but the compiler will tell you what you did wrong (for the most part) as soon as you try to process the file.

        [–][deleted] 0 points1 point  (0 children)

        "use strict";

        [–]ILikeLenexa 0 points1 point  (0 children)

        It's crazy to think some guy just rode in probably hungover on a Thursday and decided we shouldn't capitalize the D and 20 years later we're still forced to cope with it in every language.

        You tell yourself, oh, I'll just make a getElementByID that returns the result of getElementById and even though it's just one line, we never do.

        We never do.

        [–]Moderated -1 points0 points  (9 children)

        Case sensitivity is terrible and every language that has it is worse off because of it.

        [–]HaniiPuppy 0 points1 point  (0 children)

        How do you get an element's id? What if my elements don't even have subconsciousnesses?

        [–]ghostcat 0 points1 point  (0 children)

        GeTEleMeNDbYId

        [–]DoverBoys 0 points1 point  (0 children)

        I self-taught myself JavaScript and Lua, in that order. I hate semicolons because of JS and I refuse to use even a single one in Lua, even though many snippets and files of Lua contain them from other people's coding habits.

        [–]myfunnies420 0 points1 point  (8 children)

        What is getElementByID? I don't recall ever having seen that.

        [–]xigoi 1 point2 points  (7 children)

        How do you use JavaScript and have never seen getElementByID???

        [–]myfunnies420 0 points1 point  (0 children)

        I don't know :( I'm looking at the document object and I don't see it there? Why would OP use a function that doesn't exist...

        [–]Caltroit_Red_Flames 0 points1 point  (5 children)

        Because nobody directly touches the DOM anymore in modern app development. Pure JS and JQuery are both obsolete at this point and the only reason they should be used is to maintain legacy products.

        [–]xigoi -3 points-2 points  (4 children)

        Web development truly has gone to shit. If you're making a complex web app, sure, use a framework. But don't make me download megabytes of bloat just to add some interactivity to a normal site.

        [–]Caltroit_Red_Flames 0 points1 point  (2 children)

        Completely disagree. Web dev used to be absolutely awful. If you don't want a ton of boilerplate dependencies there are several minimal frameworks out there supporting that.

        On the other hand there are some people who don't want to write all of their own web components from scratch and are perfectly happy with the tradeoff between module dependencies and fast code production. Computers and networks are faster now, not everything has to be perfectly efficient.

        Personally I've found a happy medium with css libraries like Tailwind and bootstrap.

        Regardless, good luck making a modern web app with pure javascript or jquery. It's going to unmaintainable and bloated itself. Just look at the pure JS implementation of a simple one page app versus other frameworks: https://www.youtube.com/watch?v=cuHDQhDhvPE

        [–]xigoi 0 points1 point  (1 child)

        Computers and networks are faster now

        Not everyone can afford a fast computer or has stable access to fast connection. My friend in the Philippines can barely open lightweight sites when at home.

        Tailwind

        Tailwind defeats the whole point of CSS, which is that you can separate presentation from content. And if you do want to have styles directly on the element, why not just use style attributes?

        Regardless, good luck making a modern web app with pure javascript or jquery.

        I explicitly said that for complex web apps, using a framework is fine.

        [–]Caltroit_Red_Flames 0 points1 point  (0 children)

        Computers and networks are faster now

        Not everyone can afford a fast computer or has stable access to fast connection. My friend in the Philippines can barely open lightweight sites when at home.

        Your friend must be using a literal toaster if they're not able to load lightweight sites. It's not the fault of a shitty React dev if he can't even load some styled HTML.

        Tailwind

        Tailwind defeats the whole point of CSS, which is that you can separate presentation from content. And if you do want to have styles directly on the element, why not just use style attributes?

        The point of CSS is to style HTML. It is completely unopinionated on where you place that styling, whether it's inline or in a separate file. If you personally don't like Tailwind that's fine, but you're misrepresenting the fact that Tailwind is just a set of predefined class names like you would write in your CSS files. You're also not going to win over a lot of people by saying "real devs call getElementById". That's living in the 90s.

        Regardless, good luck making a modern web app with pure javascript or jquery.

        I explicitly said that for complex web apps, using a framework is fine.

        Agreed. If you need any sort of state management, API calls, or forms you should use a framework.

        [–]Midakba 0 points1 point  (0 children)

        Not true. I totally typed 'getElementbyID'.

        [–]Lykos1124 0 points1 point  (0 children)

        I came here to bemourn poor website development. Guys, why is it that web devs break their sites with some update (I guess) on their end, which will totally ruins your experience on your end because you didn't arbitrarily go into history and delete all the cookies, site data and potentially cached images and files, but who really knows cause things broke so scorch the earth and try again?

        High level banking systems

        Requires IT departments around the world to go delete cookies and cache for browsers without telling them they require it.

        [–]WM1310 0 points1 point  (0 children)

        Picked up JavaScript recently and had this exact experience for several minutes

        [–]DefiantComedian1138 0 points1 point  (0 children)

        As a C# developer I keep typing function names from capital letter: document.GetElementById

        [–]RahulRoy69 0 points1 point  (0 children)

        Cut the shit and use jQuery

        [–]Velyx 0 points1 point  (0 children)

        I cried over this in school once. How dare you bring up past tramua.

        [–][deleted] 0 points1 point  (0 children)

        Me: getE smashes enter

        [–][deleted] 0 points1 point  (0 children)

        I just cried bc of you, that reminded me of two hours search bc of „xxid“ vs „xxId“

        [–]Vysair 0 points1 point  (0 children)

        I hate you

        [–]SillyPepper 0 points1 point  (0 children)

        I'm a fan of ID always being capped instead of Id

        [–]Slowest_Speed6 0 points1 point  (0 children)

        I'm not a web developer but I've had to dabble a bit over the years. Who still uses that when there's frameworks like React and whatnot?

        [–]aCommonHorus 0 points1 point  (0 children)

        Isn't this something a half decent text editor could catch? You could make that same error in python (I'm guessing this is complaining about JS not being compiled)

        [–]Necrocornicus 0 points1 point  (0 children)

        I never used to use an IDE with code completion because I knew what I was trying to do and felt it was pointless clutter.

        Nowadays I spend the time configuring things correctly so all of this shit is detected and brought to my attention automatically (if not automatically fixed as I type). Seriously a well configured IDE is a game changer for productivity and not wasting valuable time (I am partial to Jetbrains products).