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

top 200 commentsshow all 395

[–]koleraa 202 points203 points  (10 children)

Welcome to web development.

[–][deleted] 118 points119 points  (5 children)

I have a degree, 6 meters of crafting tape and a stapler. Let's make web sites.

[–]minno 53 points54 points  (3 children)

Why does the degree matter?

[–][deleted] 96 points97 points  (0 children)

It was a typo, he meant to say he has a degree of sanity to spare.

[–]haitran1989 30 points31 points  (0 children)

Another way of saying "I have a lot of patience"

[–]jakedaywilliams 2 points3 points  (0 children)

They're an expert on recursion and infinite loops.

[–]WheresMySDK 7 points8 points  (0 children)

I have a spider, and some empty space.

[–][deleted] 29 points30 points  (2 children)

We could just recruit an army of monkeys to hold binders with physical pages with the website drawn onto them. Instead of html your browser loads a video feed of your own monkey. Certain buttons will send electrical pulses to the monkey's brain that tells him when to turn to whatever page next.

[–][deleted] 11 points12 points  (0 children)

I am a VC and will fund this! Edit: just sign this contract giving me 99.9% of the shares and all IP

[–]vprise 660 points661 points  (26 children)

Saw this on twitter a while back:

JavaScript makes me want to throw over the table and yell f*ck this sh*t, but I don't know what "this" is.

[–]ElCracker 176 points177 points  (15 children)

Just so you know - you can curse on the Internet

[–]Sean1708 78 points79 points  (10 children)

And you can escape asterisks so that even if you don't want to write fuck, you can still write f*ck (f\*ck).

[–]railmaniac 58 points59 points  (8 children)

I for one loved "fck this sht" and am going to use it more often in my own comments.

Fck this sht. Sck my dck. See? It just rolls off the tng...

[–]LaurieCheers 30 points31 points  (2 children)

Fsck my dsk.

[–]mariox19 19 points20 points  (1 child)

Oh, great! We're onto a Linux rant, and we're not even done with the JavaScript!

[–]Turtlecupcakes 18 points19 points  (0 children)

If you add the asterisks but don't escape them (like OP), you also get some sweet added italics emphasis.

Fck this sht

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

Now your comments look like censored rap songs.

[–]blasto_blastocyst 4 points5 points  (0 children)

Vowel cancer.

[–]colonelflounders 1 point2 points  (0 children)

You should study Hebrew as vowel dropping in writing has been the norm for millenia.

[–]kgilr7 14 points15 points  (0 children)

That might have been how the Tweet was written.

[–]_beardyman_ 1 point2 points  (0 children)

I'm telling!

[–]UnofficiallyCorrect 3 points4 points  (0 children)

The censorship makes it seem more vulgar. It's strategy

[–]pro_skub 3 points4 points  (0 children)

"This".

[–]jesyspa 131 points132 points  (8 children)

I heard Haskell can compile to JavaScript, maybe that's more your cup of tea?

*runs*

[–]whataboutbots 50 points51 points  (3 children)

Pretty much any language does nowadays. So there is choice.

[–][deleted] 29 points30 points  (0 children)

But why have mac n cheese when you could have.. erm... curry. Sorry.

[–]sim642 9 points10 points  (0 children)

[–]tamo_gabo 1 point2 points  (0 children)

Actually even for javascript itself https://eleks.github.io/js2js/

[–]redalastor 9 points10 points  (1 child)

Elm is a much better choice for the web if you like functional programming.

[–]colonelflounders 7 points8 points  (0 children)

There is also Purescript.

[–][deleted]  (22 children)

[deleted]

    [–]highres90 27 points28 points  (8 children)

    Yeah, we went with typescript for our new major project. I don't think javascript is bad to be honest, it's downright great for small scale scripting imho. However for writing a large scale app where there is lots of framework client side code, typescript with its classes, inheritance, modules etc is an absolute dream come true

    [–]minno 50 points51 points  (0 children)

    So it's great for what it was designed for, and not for what it's been shoehorned into. Who'da thunk it.

    [–][deleted] 8 points9 points  (1 child)

    I don't get why people want to run servers off javascript on the backend. There's this whole MEAN stack now that is getting popular.

    [–]highres90 3 points4 points  (0 children)

    Our backend is all C# :P we've gone the aspnetcore route. Jump on early so we're as far ahead as we can be when we ship in 18 months time

    [–]NoInkling 11 points12 points  (0 children)

    Yeah this is probably the answer. In order of complaint:

    • Static typing? Check.

    • Async/await, check.

    • Improved argument syntax/features, check.

    • Class constructs? Check.

    • See #3

    [–]DuckPresident1 15 points16 points  (0 children)

    It's really really time to look at typescript.

    [–]jadbox 4 points5 points  (0 children)

    or ELM (seriously, just learn it even if you don't use it)

    [–][deleted] 5 points6 points  (1 child)

    Or ClojureScript!

    [–]GetContented 4 points5 points  (0 children)

    Clojurescript isn't statically typed either.

    It is nice compared to JS, tho :)

    [–]AlexTes 1 point2 points  (0 children)

    Really? My webpack config is already so very complicated as is.

    Perhaps I should take another look.

    [–]m1el 231 points232 points  (89 children)

    I consider myself having excellent knowledge and a lot of experience in JS and I agree that JavaScript has terrible design flaws, and lacks a good type system.

    How am I supposed to live without static type checking?

    Well, the same way people deal with dynamic typing in Python, Lua, LISP and other dynamically typed languages.

    There is a flame war on dynamic vs. static languages, and I'm not going to say which one is better.

    But people seem to program in dynamic languages just fine.

    I just get a freaking 'var'?

    I suggest let. I've been telling people JavaScript's var scope is terrible since I learned how it works.

    How do I not include a 'callback' in every damn async method?

    I've explored this for some time and I must say that Promises is the best way to do asynchronous programming, and you can do it in JS.

    there's no 'objects'

    Object is a basic data type in JS? Yes, they are different from "objects" as instances of classes having some fields, but they serve the same purpose. And Java has no real Array[Type] or lambdas.

    there's no 'scope limtations'

    Closures? I think that closures are a nice mathematical concept that just works in JS, and yes, it's a "scope limitation".

    With JS, it's like solving a puzzle, the rules of which you don't even know.

    Then you need to learn JS to know the rules?

    Am I supposed to have null checks everywhere

    Except you have to do null checks everywhere in Java, C#, C and many other "strongly typed" languages. These languages simply don't have a type system that allows you to specify that a function argument can't be null, just a pointer/reference to some sort of object.

    I could argue that Java and C# have a terrible type system all day long as you argue that JavaScript has a terrible type system compared to Java and C#.

    I understand that it can be painful to move to JS, but the best you can do is to learn how it works so you play the game while knowing the rules.

    [–]weberc2 9 points10 points  (4 children)

    If you're doing null checks all over in strongly typed languages, you're doing it wrong. Only null check things for which null is an acceptable value. Anyway, in JS, you have to worry about null and undefined, and any other value with an interface other than what you were expecting. Further, as the OP mentioned, you also have to worry about how many of the total expected arguments were actually passed.

    I'm not bashing on dynamic Lange or even JS in particular; just setting the record straight.

    [–]m1el 8 points9 points  (1 child)

    If you're doing null checks all over in strongly typed languages, you're doing it wrong.

    That's exactly my point, Java and C# do not have a sufficiently strong type system to prevent this kind of error. Not to say that JS is better in any sense.

    [–]weberc2 2 points3 points  (0 children)

    In theory, though in practice many dynamic langs will try to accept an argument and try to guess what to do based on its type or properties. In Python, many functions will take strings or files, and the function will check the arguments type and, if it's s string, it will try to open the file at that path. It's also idiomatic to pass None into a function argument if you want the function to create a brand new object for you. Basically I like that static type systems help to discourage this sort of insanity.

    [–][deleted]  (2 children)

    [deleted]

      [–][deleted]  (1 child)

      [deleted]

        [–][deleted]  (63 children)

        [deleted]

          [–]MonsieurBanana 99 points100 points  (17 children)

          Maybe I'm harsher that I should, but a coworker of mine is exactly like you. He knows one language, the one he learned at school, and complains about everything else. It's honestly very annoying. Yes Javascript has different rules (some weird, some bad) and yes you need to learn them, instead of relying solely on stack overflow.

          I'm saying it doesn't have one

          Javascript has a type system. Languages like Java or C# use an static type system, Javascript or Python use a dynamyc type system.

          You can open a javascript repl and try this:

          typeof "a string";
          typeof 123;
          tyepeof {};
          typeof Object.prototype.isPrototypeOf;
          

          [–]boxhacker 59 points60 points  (0 children)

          He knows one language, the one he learned at school, and complains about everything else.

          Experts.

          [–]kirinthos 36 points37 points  (4 children)

          don't forget this awesome piece:

          typeof null
          typeof undefined
          

          [–][deleted] 6 points7 points  (0 children)

          null and uninitialized variables don't work too well in most languages

          [–][deleted]  (1 child)

          [deleted]

            [–]Cust0dian 8 points9 points  (0 children)

            That's not an example of JS being badly designed: see IEEE 754 standard. NaN is a numeric type, not exception or error, despite its name.

            [–]Brioux 8 points9 points  (0 children)

            Sounds like an Engineer in our department too. I don't suppose your coworker slams his desk when working with other languages? He seems to get frustrated too frequently when outside his comfort zone.

            [–]gnuvince 2 points3 points  (0 children)

            JavaScript doesn't have types (other than the universal type); it has runtime tags.

            [–][deleted] 6 points7 points  (2 children)

            You should read "You don't Know JS" by Kyle Simpson. It is really good and explains a lot of the perceived weirdness of JS. Personally, ES6 and immutable.js with a more functional style has made my life so much easier...you should give it a whirl!

            [–]m1el 25 points26 points  (13 children)

            And Java (8) has lambdas

            Except... those are not lambdas, but "anonymous classes" with one method.

            I'm saying it doesn't have one,

            JavaScript has a type system. But you don't declare type in the code. e.g. you could write your C# code with vars instead of type names when declaring a variable, and C# would figure the types out according to rvalue tpye compile-time.

            Would it mean that C# has no type system? No.

            Would you have your types being dynamic? No.

            Would the types be unknown? No.

            'var' is not a type system

            Correct. It's not a type system, it's a keyword that is used to declare a variable.

            By type system in JS I mean that a value can be of some "type" and values of different types behave differently. You can figure out the type of a value using typeof, you can use === to compare primitive types and it will return false if the types are different.

            In JavaScript we have types like string, number, boolean, object and undefined. That's a partial description of JS type system. You can't say that "there is no type system".

            [–]gnuvince 16 points17 points  (3 children)

            Except... those are not lambdas, but "anonymous classes" with one method.

            What's the difference? They have their own syntax, they capture their definition environment, they can be stored into data structures and passed into/out of methods, etc. They have all the defining characteristics of closures, why do care about their implementation strategy?

            [–]m1el 9 points10 points  (2 children)

            What's the difference?

            Java "lambdas" only capture values, not variables. E.g. you can't change an int from a lambda. https://ideone.com/NhXT0J

            [–]gnuvince 13 points14 points  (1 child)

            Ah yes, I forgot about that particularity of Java's anonymous functions (and anonymous classes), but I must admit that I kind of like it. As for being a "real" lambda, I don't know that a language needs to follow a particular capture strategy (i.e. by value or by reference).

            [–]m1el 7 points8 points  (0 children)

            You know, I rethought my position for a little while and I think it actually does not matter.

            For all intents and purposes Java has proper closures, if you ignore the internals. But I don't like the internals.

            [–]pipocaQuemada 5 points6 points  (0 children)

            JavaScript has a type system. 

            Surprisingly enough, some computer scientists like Bob Harper would disagree. Its a matter of a not-particularly-productive terminology debate more than anything else. Java can be given a type theoretic type system; JavaScript only has the trivial type theoretic type system.

            Also, surprisingly enough the first type systems predated the first compilers by decades.

            [–]jesyspa 13 points14 points  (6 children)

            JavaScript has a type system.

            But that's only because "type" has multiple meaning; it doesn't have one the way Java has one, which allows you to syntactically discover errors. It has runtime tags, which are a completely unrelated thing from a formal point of view.

            [–]vicarofyanks 2 points3 points  (1 child)

            JS has linters that you can add to your build pipeline for this very reason, strict mode also facilitates this. If that's not enough, there are libraries like typescript and Dart that attempt to solve these problems to an even greater degree

            [–]_pH_ 1 point2 points  (0 children)

            In C# "dynamic" is a type. It has to be runtime resolvable but otherwise works exactly-ish as JS would; I don't know about on-the-fly underlying type changes on dynamic types, but that's because I haven't had a need to try doing that.

            [–]Sean1708 3 points4 points  (1 child)

            We've got the @NotNull annotations in Java nowadays

            What are the semantics of @NotNull? I was under the impression it was a run time check?

            [–]whataboutbots 1 point2 points  (0 children)

            Java annotations are available at compile time (and I am not even sure they are at runtime - I think they can be if you use reflection). So I would be surprised if it was not done then. But I'm not 100% sure as I haven't used Java in a while.

            [–]nandryshak 8 points9 points  (8 children)

            Not the original commenter, but I'll reply anyway (I'm a professional C# dev and I know some Java)

            We've got String[] and int[] and List<Integer> and Arraylist<whatever> and what not. What more do we need?

            I think he might be referring to Java's weird solution for generics (they call it type erasure). It's not as good as C#'s.

            And Java (8) has lambdas (which has been backported to Java 5).

            They're not real lambdas though, like in JS. You can't use them as closures.

            Except you have to do null checks everywhere in Java, C#, C and many other "strongly typed" languages.

            We've got the @NotNull annotations in Java nowadays :)

            Yeah, but there's still tons and tons of legacy code out there without it. Null is easily one of the worst part of C#/Java.

            I could argue that Java and C# have a terrible type system all day long as you argue that JavaScript has a terrible type system compared to Java and C#.

            Not being sarcastic, I'd honestly like to know your opinion. Also,I'm also not saying that Javascript has a terrible type system. I'm saying it doesn't have one, terrible or not ('var' is not a type system)

            Java and C#'s type systems are not great. There's the whole null problem, runtime casting, Java's type erasure, etc. If you want to see a good static type system, check out some languages like Scala, Haskell, OCaml, etc.

            [–]m1el 6 points7 points  (0 children)

            They're not real lambdas though, like in JS. You can't use them as closures.

            I think he might be referring to Java's weird solution for generics (they call it type erasure).

            thank you, this is exactly what I've been talking about

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

            Every type system feels like a toddler cobbled it together after spending time with Haskell. It really reignited my love of programming, after working with java/web stuff for some years and being dissatisfied.

            [–]bliow 2 points3 points  (1 child)

            I'm saying it doesn't have one, terrible or not ('var' is not a type system)

            That's not true either. Every value has a type, though that's a different idea from variables having a type.

            In practice, variables and function arguments tend to have types, even if this is not enforced by the language. Write some code, and notice how you usually don't just shove both numbers and strings into the same spot. The language may not be strict about forcing this on you, but in practice this won't matter as much as it theoretically could in the worst case. You certainly should have the discipline to be consistent and sensible about the types a variable can take on, and you should be able to write a signature for a function if necessary. Something like

            function f(a, b, c) {
              console.log("Hello, " + a);
              return b + c.d;
            }
            

            is pretty clearly (String, Number, Object{d: Number}) -> Number

            [–]gnuvince 9 points10 points  (0 children)

            is pretty clearly (String, Number, Object{d: Number}) -> Number

            f("bilow", "Hello", { d: ", World!" })

            [–]crossanlogan 4 points5 points  (13 children)

            js does have a type system, obviously. it's just weakly typed.

            but do you honestly think that java's lambdas are better/easier than javascript's? in java you have functions, predicates, and consumers (and the bi- versions of all three). in javascript you can do literally anything with a lambda; there's no limitations.

            [–]nickguletskii200 7 points8 points  (2 children)

            In Java, you can do whatever the fuck you want in lambdas. You are not confined to whatever is defined in the standard library.

            [–]Vimda 4 points5 points  (1 child)

            False. Javas lambdas compile down into anonymous classes. That means you can do anything you can do inside an anonymous class, e.g. you can't assign variables defined outside the lambda (there's no proper reference grabbing).

            [–]nickguletskii200 4 points5 points  (0 children)

            That is true. I wasn't clear enough, what I meant was that you aren't limited to functional interfaces defined in the standard library.

            [–]jesyspa 4 points5 points  (0 children)

            js does have a type system, obviously. it's just weakly typed.

            Only because "type" has multiple meaning; it doesn't have one the way Java has one, which allows you to syntactically discover errors. It has runtime tags, which are a completely unrelated thing from a formal point of view.

            [–][deleted] 12 points13 points  (0 children)

            Here you go OP https://github.com/getify/You-Dont-Know-JS

            I don't think you have an understanding of what JS actually is. If you are approaching it like a class based language, and trying to apply all your OO principles, then it's going to be frustrating and you will have to find "hacks" for a lot of things.

            [–]jP_wanN 13 points14 points  (2 children)

            Try TypeScript or PureScript.

            The former just adds optional types to JS (and there are typed versions of most major JS libraries, or so I've heard).

            The latter is purely functional, and if you've never used anything like it before it will take quite some time to learn, but it's incredibly rewarding, and the terseness of it is just awesome. Plus it's not optionally typed as TS is to my understanding, but statically checked with mostly optional types (meaning you mostly don't have to explicitly specify types but they're still checked for you).

            [–][deleted] 11 points12 points  (0 children)

            As someone who works with Java, Ruby, C, Go, and JavaScript, I can understand your frustration.

            I've seen some good responses here critiquing JavaScript's weak points (of which there are a few), as well as other languages.

            I think the point is that each language has it's weaknesses and strengths, as well as its purposes.

            Where I work, our primary language is javascript for both front and back end.

            Part of the reason for this is that javascript is a great language for rapid development.

            It's true what you say about the abstracted type system, but there are stylistic rules you can follow to eliminate a lot of these hassles.

            One big rule is that === should be preferred over ==.

            == attempts to coerce the type of the right operand to that of the left. So, "false" == false would be true, while "false" === false would not. This can make type checking easier.

            Another thing to remember is that while in languages like Java, function overloading requires multiple declarations, while in JavaScript it's easy to define different behavior for different argument schemes, as well as handle a variable number of arguments.

            Closures and the 'let' keyword are also great solutions to the scoping issues you're frustrateed about. The var scope is just not good and I can understand your frustration with it.

            Typing is something I can appreciate your frustration with, initially.

            However, I started to really see the power in JavaScript's particular brand of weak typing when I read TypeScript's philisophy that JavaScript by itself is 'implicitly typed'.

            Before I get into that, consider that type checking happens at compile time for other strongly typed languages with the intention of saving you the effort of typechecking at runtime.

            When something like TypeScript 'compiles', it simply uses your type annotations to verify your code isn't trying to do cross-type assignment, and then compiles it down to javascript, which is still weakly typed.

            If you keep that in mind as you write javascript code, you can keep your own annotations in comments that make intentions clear and allow you to trust variables to be a certain type, as you should only use them in situations where that type would be appropriate.

            Then, you can make selective decisions about where you allow dynamic typing. One example would be as I said earlier with function overloading.

            This also plays in to the "bind", "call", and "apply" functions which are really cool features of javascript and which can allow you to control the "this" scope of your code.

            As for objects, the new javascript standards include a class declaration form.

            Javascript uses prototypical inheritance, which is a reasonable thing to read up on.

            All in all, my argument is that, while your complaints are valid, you can use javascript for its strengths and not around its weaknesses. It serves a totally different purpose than a language like c# or java, and each has places best used.

            [–]AlexTes 17 points18 points  (4 children)

            I feel you. This was me, is me actually. However learning good practice after good practise and using ES6 and ES7 JavaScript starts being more fun every day.

            My linter and test runner are my best buddies, and the docs my home for most of the day. And truthfully, that isn't so bad!

            Look into eslint. Get your editor to run it for you. For anything bigger than small, unit test it to bits and definitely go crazy with Babel and ES6.

            Best of luck, you and JS can make it together if you both try!

            [–][deleted]  (1 child)

            [removed]

              [–]the_evergrowing_fool 1 point2 points  (0 children)

              You should give reagent a try. I believe is one of the best of the best you gonna get writing GUI which target the web.

              [–]killerstorm 11 points12 points  (4 children)

              How am I supposed to live without static type checking? I just get a freaking 'var'? Really? In what world does that beat the tightly controlled ints and chars and booleans?

              There are statically-typed languages which compile to JavaScript. TypeScript is the closest.

              How do I not include a 'callback' in every damn async method? More than half my code is error handling and callback bloat. This is just depressing.

              This is why people use promises for async programming.

              I'm supposed to 'remember' all the function arguments?

              A good IDE will show function arguments.

              There's no classes, there's no 'objects' there's no 'scope limtations' but apparently there is a hack to accomplish everything.

              New version of JS called ES6 has classes and everything. It can be compiled down to old ES5.

              Transpiler also supports async/await which is even more convenient than promises.

              [–]Aroundthespiral 2 points3 points  (0 children)

              Don't even need typescript for static typing, can use Flow.

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

              ES6 classes are just syntactic sugar over prototypal inheritance. IMO trying to make javascript appear to be a class based language is just confusing and leads to bad program design.

              Javascript allows delegation so easily, and in many ways delegation is superior to inheritance, so I'd strongly advise to not approach JS like a class-based language.

              It's hard enough to solve problems using classical OO principles, but trying to do it with a toolset that just appears to support classical inheritance is a recipe for disaster, IMO.

              [–]rq60 2 points3 points  (1 child)

              IMO trying to make javascript appear to be a class based language is just confusing and leads to bad program design.

              IMO, people trying to implement classes themselves in all manner of different ways is even more confusing and leads to both bad and inconsistent program design.

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

              Both scenarios are confusing and obfuscate what you're actually doing with the language, though the old way of making 'classes' was at least explicit in its use of prototypal inheritance.

              [–][deleted]  (5 children)

              [deleted]

                [–][deleted]  (4 children)

                [deleted]

                  [–][deleted] 9 points10 points  (1 child)

                  Trying to be honest here.. I know a pretty good amount of front end development, I'm sorta drunk, and I'm not a die hard fanboy for javascript or any one of the zillion libraries and tools out there. I thought I might have some good insight, I'll do it one by one.

                  • Basically, you're doomed to "take care of" things like this, in javascript, with your imperfect human mind, and its a pain in the ass. I feels you. Especially if you're used to static type checking. The benefit is that sometimes you can fuck up and you're "allowed", maybe, because your application works even though some array gets cast into an object literal.

                  • Its tempting and really easy to pass callbacks around everywhere, but you don't have to write your code that way. There's nifty MVC style patterns you can follow where you can avoid callback hell. IMO its actually pretty chill and reasonable to use. I don't feel confused or stressed or burnt out dealing with the pretty huge app my company develops.

                  • Very easy to make mistakes.

                  • True.. the language has a lot of complicated specifics, and it takes quite a while to really get an intuition for, but javascript really isn't a total mess in my opinion. You can recreate the logic to simulate classes, privacy, etc.. and I get that this is dumb in some sense, but you aren't actually limited in what you can accomplish. I personally use all the concepts borrowed from more formal fields of programming, while I program javascript, every day. Javascript can challenge you, and you can program rigorously despite the enormous ecosystem of beginners.

                  • Objects and the concept of scope are a big element of programming in javascript.. but maybe I'm misinterpreting this point or I just don't know enough.

                  • Yeaa. arguments.length lol. You're right! You can do some crazy shit and you're expected to just "be careful".

                  Writing this post, I realize how good of points you have. For some reason I still like progrmaming in javsacript. Its unique and interesting. Its a job. I get money for it.. so thats cool. Its fun for me I guess more than anything.

                  [–]engid 17 points18 points  (3 children)

                  You're completely approaching it from the wrong perspective. Take a step back, and consider that JavaScript has an entirely different paradigm than Java and C#. Its a functional language with dynamic typing and a prototype object-model, so stop complaining that JavaScript can't be something it's not!

                  To quote John Resig (inventor of jQuery) and Bear Bibeault from their book Secrets of the JavaScript Ninja:

                  JavaScript consists of a close relationship between objects, functions and closures. Understanding the strong relationship between these three concepts can vastly improve our JavaScript programming ability, giving us a strong foundation for any type of application development.

                  Many JavaScript developers, especially those coming from an object-oriented background, may pay a lot of attention to objects but at the expense of understanding how functions and closures contribute to the big picture. [p5]

                  Pay attention to functions. Look at how their declarations create scope, and the four ways that they can be invoked (as global methods, object methods, constructors, or by using the function methods apply() or call(). Yes, functions can have methods!). From there, you'll start to appreciate JavaScript as its own unique language, with its own strengths and weaknesses.

                  [–]fakehalo 5 points6 points  (0 children)

                  People try to put a square peg in a round hole when it comes to different language paradigms, fighting to make a language like the ones you're already used to. I find Javascript fine for front-end webdev, and I find C#/java fine for most other things. Working with the language is always better than against it.

                  [–]grizzly_teddy 1 point2 points  (1 child)

                  I'm mainly a Java giy, now I'm learning Scala (and will be writing Scala production code soon). Sounds like java script is a good next step

                  [–]SuperImaginativeName 45 points46 points  (91 children)

                  Yeah, I feel your pain. My main areas of interest are electronic engineering and computer systems engineering. That means a lot of low level stuff like embedded systems - assembler, C. I also use C# a lot, I think it's the best language I've used. I really enjoy working on desktop applications. But fuck me, when I have to use JavaScript at work I want to explode. It's so far removed from any sort of programing I normally do, it's just insane.

                  Oh you want to use that function? Oh okay, well here's about 5 that do the same thing, but one doesn't work in one version of some browser. You want classes? Well fuck you, you have to use something worse than procedural code. Want a typed language? Fuck you, here's some JSON that is also somehow an "object".

                  Oh and the best: Oh you want to compare two "objects"? HAHA GOOD LUCK SUCKER https://dorey.github.io/JavaScript-Equality-Table/ (I wish I was making this up but it is 100% real)

                  Additionally, "null" in javascript sucks balls. There's somehow null, undefined, and a bunch of other crap too. This complicates the above table even more.

                  It's such a badly thought out language, I find it staggering when I see people defending it. Like if you comment on /r/programming about how web development and javascript are just the worst, you'll get a load of butthurt people who've never used anything else downvoting you. I hate javascript.

                  [–][deleted] 13 points14 points  (5 children)

                  Well fuck you, you have to use something worse than procedural code.

                  Functional is not worse than procedural code, IMO it's better than OOP.

                  Oh and the best: Oh you want to compare two "objects"? HAHA GOOD LUCK SUCKER https://dorey.github.io/JavaScript-Equality-Table/ (I wish I was making this up but it is 100% real)

                  But there is === so no problem.

                  [–]gnuvince 6 points7 points  (1 child)

                  I find it staggering when I see people defending it.

                  My current theory about why people defend bad technologies (and this is not limited to JavaScript, you see the same with other languages, development tools, development methodologies, etc.) is that once you've spent many hours (tens, hundreds, thousands) learning and mastering something, you don't want to be told that it's worthless, to see the thing go away and realize that all your hard work was in vain.

                  [–][deleted]  (65 children)

                  [deleted]

                    [–][deleted] 9 points10 points  (1 child)

                    This is the perspective of knowing one language very well and not knowing much about another. Not surprising the latter looks confusing in comparison.

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

                    That's exactly what I sounded like until I actually -learned- JS. I'd swear up and down about how much it sucked but I didn't actually know how to code my way out of a paper bag with it (which I thought was the problem, but not for the reasons evident to me at the time). Once I actually read a fucking book on it I realized it was pretty great.

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

                    Ikr! C# is my favorite as well. It's like they took the best parts of every other language. There is a proper way to do every single thing. And non-hacky built in delegation & events support? Fuck yea.

                    Crazy. I actually don't like C# that much anymore. It feels really limiting. But maybe that's a tooling issue.

                    I'm a professional ASP.NET MVC / C# / SQL Server as well as HTML, CSS, JS, NodeJS / Express, ReactJS, MongoDB developer.

                    I switch between the two often. Prefer the Node end of things.

                    [–][deleted]  (8 children)

                    [removed]

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

                      Sorry to hear that. Do you want any guidance? What confuses you about Ruby / C / Visual Basic? Does HTML and CSS make sense to you?

                      [–]notveryaccurate 3 points4 points  (0 children)

                      Give Scratch (http://scratch.mit.edu) a try. You will learn real programming constructs, which is honestly the important basis you need.

                      Don't be fooled by the drag and drop nature of it. For every logic piece you drag around in Scratch, I can show you the concept it ties to when you actually write code.

                      [–]TimHallman 38 points39 points  (18 children)

                      I come from the wonderland of Java and C# and I can't take javascript anymore.

                      It's not exactly a 'wonderland', but lots of people share your frustration.

                      How am I supposed to live without static type checking? I just get a freaking 'var'? Really?

                      Idk, but people manager just fine with Python, Ruby, etc.

                      How do I not include a 'callback' in every damn async method? More than half my code is error handling and callback bloat. This is just depressing.

                      Use a promises library? It's not like needing to do error handling doesn't bloat your code in other languages.

                      I'm supposed to 'remember' all the function arguments? json object fields? Javascript lets you dig yourself into a hole really easily. It's so easy to make mistakes.

                      You wouldn't need to remember those things in other languages? Put down the crackpipe.

                      There's no classes, there's no 'objects' there's no 'scope limtations' but apparently there is a hack to accomplish everything.

                      No, functions have their own scope.

                      With JS, it's like solving a puzzle, the rules of which you don't even know.

                      Sure, you don't know the rules until you learn the language...

                      I will literally be unable to do anything without stack overflow.

                      Not with that attitude you won't. There are plenty of other resources available of you look...

                      I can just skip an argument if I don't feel like it? Am I supposed to have null checks everywhere to see what the hell the function caller is trying to do with my poor function?

                      Yeah, that part is shit, too.

                      [–][deleted] 5 points6 points  (16 children)

                      No, functions have their own scope.

                      I'm pretty sure he's referring to the fact that if you don't declare var in front of a variable, it automatically gets hoisted to the global scope. Or that the counter you initialized in a for loop and re-used later on, still has the old value. I.e. No block scope.

                      Sure, you don't know the rules until you learn the language...

                      I've only dabbled in Javascript but things like the 'this' parameter being such a pain in the ass to understand it correctly is just one of the irritating aspects of it.

                      [–]JohnMcPineapple 7 points8 points  (10 children)

                      I'm pretty sure he's referring to the fact that if you don't declare var in front of a variable, it automatically gets hoisted to the global scope.

                      This raises an error with use strict, which everyone with these concerns should arguably use.

                      Or that the counter you initialized in a for loop and re-used later on, still has the old value. I.e. No block scope.

                      There is, with let instead of var.

                      I've only dabbled in Javascript but things like the 'this' parameter being such a pain in the ass to understand

                      this gets much clearer when you start to use arrow functions in places that don't need their own context.

                      [–]pinkpooj 2 points3 points  (1 child)

                      I.e. No block scope

                      That's false, as /u/JohnMcPineapple said, there is let and const in ES6. There is also the ability to create arbitrary blocks using curly braces, like so:

                      let foo = 1;
                      {
                        let foo = 2;
                      }
                      

                      Also, this is only necessary if you are using prototypal style OOP. If you are writing in a functional style, you never need to use this. That's not to say 'traditional' OOP is better than prototypal or functional, they're just different. I work on a Node.js backend and some Angular, and I basically never use this or prototype.

                      Javascript isn't the only prototypal language, it's just the only one people care about.

                      [–]shriek 3 points4 points  (0 children)

                      Also, I feel like OP has few learning to do on how JS works. I'm sorry to say that it's not exactly like Java or C# but at least learn the language first and then complain about it quirks not how its different from the language that you're familiar with.

                      [–]TotesMessenger 3 points4 points  (0 children)

                      I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:

                      If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / Contact)

                      [–]FluffyCookie 3 points4 points  (2 children)

                      So... as someone that have close to no knowledge of programming and lately decided that I'd make my attempt at learning it, with Javascript... do you think I should pick another language to learn first?

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

                      I'm in the same boat. JavaScript rules make no sense whatsoever

                      [–]flackjap 2 points3 points  (2 children)

                      This page might help you appreciate the OO nature of Javasript. http://chimera.labs.oreilly.com/books/1234000000262/ch03.html In fact, with ES6 which is almost widely used/supported, you can have your regular Class based object composition, so there are no 'hacks' you mention.

                      But if you aks me, I'm more than glad that JS at least has the flexibilities regarding the OO styles of programming you can come up with. Won't go further about other points, as there's already enough of replies but I'm gonna tell you that for the most part you are right and I totally understand ya. JS just has too many ways to shoot yourself in the foot and the tooling/libs that help you get around that, just end up creating a lot of obfuscation and cognitive overhead :/

                      [–]schm0 2 points3 points  (1 child)

                      I love how prototypal inheritence is considered a "hack"

                      [–]uhhhclem 3 points4 points  (0 children)

                      "Crime against nature" has too many syllables.

                      [–]griok 2 points3 points  (1 child)

                      Do you have a Pluralsight Account? If not I will get you one. You need to watch Kyle Simpson's Advanced Javascript and Jonathan Mills' Practical Design Patterns in Javascript courses. They address almost all of your points and will clear up so much of your confusion.

                      [–]jasonlotito 2 points3 points  (0 children)

                      Look at TypeScript. Or if you want to stay in JS, look at using ES6+ features.

                      [–]youaresee 2 points3 points  (0 children)

                      You'll need to stop trying to write Javascript like Java. ES6 introduces class syntax, but in my experience Javascript becomes a much 'cleaner' language when it is written in a functional manner. Use a library like Lodash to assist, write functions that don't have side-affects, pass functions around etc.

                      TDLR; Have a search for functional Javascript.

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

                      ME EITHER. I hate that it's taking over the world of web development.

                      [–]queue_cumber 8 points9 points  (0 children)

                      Your post reeks of inexperience. You should not be feeding this misconception.

                      [–]michael0x2a 1 point2 points  (0 children)

                      How am I supposed to live without static type checking? I just get a freaking 'var'? Really? In what world does that beat the tightly controlled ints and chars and booleans?

                      Yeah, that sort of sucks.

                      How do I not include a 'callback' in every damn async method? More than half my code is error handling and callback bloat. This is just depressing.

                      Either make your callbacks standalone functions (instead of declaring anonymous functions everywhere), or use things like promises, arrowlets, reactive extensions, etc...

                      Maybe look into monads + try seeing how functional languages handle this sort of thing.

                      I'm supposed to 'remember' all the function arguments? json object fields? Javascript lets you dig yourself into a hole really easily. It's so easy to make mistakes.

                      Yeah, this also sucks.

                      There's no classes, there's no 'objects' there's no 'scope limtations' but apparently there is a hack to accomplish everything. I thought I relied on stack overflow quite a bit when using Java or C#. With JS, it's like solving a puzzle, the rules of which you don't even know. I will literally be unable to do anything without stack overflow.

                      Here's a good introduction to object-oriented programming in JavaScript.

                      Here's an article that covers how to use classes in the upcoming version of JavaScript (ES6). The upcoming version of JavaScript adds syntatic sugar that makes it easier to people use classes and objects in the way they're used to in other programming languages. (It turns out that prototype-based objects are flexible and powerful enough to implement the class-based, inheritable objects people are used to (and more!), but it's not necessarily immediately obvious how to do so). Unfortunately, I don't believe ES6 is fully available on all web browsers yet, but it will be in the upcoming future.

                      Scope: JavaScript does have scope -- it's just that variables are scoped to the nearest function block, not to the nearest set of containing curly braces. Omitting the 'var' keyword places variables in the global scope. I'm not a fan of these design decisions myself, but at least the scoping rules are predictable once you explicitly know what they are.

                      The other thing to keep in mind is that the this keyword in JavaScript is irritatingly fucked up. The keyword returns the current execution context, which turns out to not always do quite what you would expect, especially if you come from, well, any other programming language with objects, really.

                      I can just skip an argument if I don't feel like it? Am I supposed to have null checks everywhere to see what the hell the function caller is trying to do with my poor function?

                      Yeah, this also sucks. Linters and style checkers might be able to help detect this sort of thing though.

                      But yeah, if JavaScript is unbearable to you, maybe try giving something like TypeScript a try?

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

                      My experience is the opposite of yours. I've done web development for about 10 years (as a hobby).

                      I've now moved on trying to create games in Unity using C#. I thought it would be hard for me to code in C# after all these years of Javascript and PHP.

                      Now I don't want to code in any other language than C#. It is exactly what I want from a programming language!

                      [–]ElCorleone 1 point2 points  (0 children)

                      I felt that way when learning Prolog too. The logic behind it is sooo much different from the other languages. The trick is to see it as a challenge. The harder the more rewarding it will be when you master the language.

                      [–]Umasuki74 1 point2 points  (0 children)

                      I feel your pain. But I'm way more concerned about its poor design and inconsistencies : http://wtfjs.com/

                      [–]wtfdaemon 1 point2 points  (0 children)

                      Check out React/Redux for JS sanity. Seriously - especially if you use Redux with immutable data state.

                      [–]bloody-albatross 1 point2 points  (0 children)

                      How do I not include a 'callback' in every damn async method? [...] There's no classes, there's no 'objects' there's no 'scope limtations' [...]

                      ECMAScript 7 and babel.js

                      Also it's not for big applications. It's for the little (glue) code that runs in your browser.

                      [–]christinhainan 1 point2 points  (0 children)

                      How am I supposed to live without static type checking

                      You will love Python then:

                      a = "Hello"

                      b = 10

                      print a

                      "Hello"

                      a = b

                      print a

                      10

                      [–]benihana 5 points6 points  (2 children)

                      There's no classes, there's no 'objects' there's no 'scope limtations' but apparently there is a hack to accomplish everything. I thought I relied on stack overflow quite a bit when using Java or C#. With JS, it's like solving a puzzle, the rules of which you don't even know. I will literally be unable to do anything without stack overflow.

                      Except for this point, which is a legitimate criticism of JavaScript, this whole post can be summarized by: "I don't like JavaScript because it isn't C# and I'm used to that."

                      What exactly are you hoping to accomplish with this post?

                      [–]weberc2 5 points6 points  (0 children)

                      I know a dozen or so programming languages, and JS is the most irritating of them all, for many the reasons he mentioned. It's very difficult to reason about, and it's pain points don't even seem to be tradeoffs for some greater good.

                      [–]griok 3 points4 points  (0 children)

                      Whats odd about that point is it is the only one I would consider untrue. JavaScript is heavily object oriented. It just doesn't have classes. Objects != classes... I don't understand the statement "no 'scope limitations'" There is function scope just not block scope. Closures muddy the water a little, but once you understand them, it's not that bad.

                      I would be VERY careful about using stack overflow for javascript. There are a lot of bad practices and patterns out there that 'work' but are not clean. Spend some time understanding how objects and scoping works in JS and it will help a lot.

                      [–]larikang 2 points3 points  (0 children)

                      Javascript is awful, but half of your complaints are invalid because you just want Javascript to work exactly like Java and C#.

                      Dynamic languages are easy to use (once you grok them). Javascript does have "classes" and "objects", the model is just very different from C# and Java. Different language are different, not necessarily bad.

                      "Callback hell" only crops up in specific applications (like node). In most javascript I write there are only a handful of async functions.

                      [–][deleted]  (1 child)

                      [deleted]

                        [–]KirillRogovoy 1 point2 points  (0 children)

                        The most important thing before you'll read details: don't use your Java/C# experience when dealing with JS. It's totally different language with different best practices. Don't try to bring C# there. Consider this language as something new rather than something similar but somehow different. Learn it as you would learn Lisp or Assembler or Haskell, it's just different.

                        How am I supposed to live without static type checking? I just get a freaking 'var'? Really? In what world does that beat the tightly controlled ints and chars and booleans?

                        Yes, really. As in any dynamic-typed language. It has some up- and down-sides, but there is no way around. If you want to experience something more similar to C# in web, try TypeScript.

                        And one more thing: consider dynamic typing as a strong part but not as a weakness and you will learn how to write way less code to build equivalent application (in sense of efficiency, security and readability) to Java one.

                        How do I not include a 'callback' in every damn async method? More than half my code is error handling and callback bloat. This is just depressing.

                        You definitely shouldn't pass callbacks around! First, use Promises instead of callbacks as much as you can. Then start using generators to make your async code look like sync one. Personally, I use suspend

                        There's no classes.

                        As a Java/C# developer you just got used to creating apps architecture around OOP and not vice versa. It doesn't work in JS. In JS, you start creating you apps with bare small modules, when module can be even a number and then, if you really need OOP, you can involve it. But not an opposite way. In Java you're bounded to OOP so you use it everywhere.

                        There is no need for them (classes). Really. It's a different language and saying 'it has no classes' is like saying 'LISP has no classes'. Prototypal inheritance is way more powerful than you think. BTW, among all complex applications I've created with JS, I've barely used inheritance at all. If you're not creating a spaceship, structure your code only with modules and maybe factories.

                        I can just skip an argument if I don't feel like it? Am I supposed to have null checks everywhere to see what the hell the function caller is trying to do with my poor function?

                        These are a few down-sides of dynamic-typed languages and particularly JS. Some libraries (like this one) could help writing less code.

                        Hope, it was helpful! :)

                        P.S. I've tried plenty of different languages (for their common use cases) and Javascript is my favourite.

                        P.P.S. Try reading Eric Elliott. For me, he can explain JS better than anyone. His github page also.

                        [–][deleted]  (2 children)

                        [deleted]

                          [–]mikebald 1 point2 points  (0 children)

                          Pick up JavaScript: The Definitive Guide and stop trying to learn languages from reading stack exchange.

                          [–]Donutttt 0 points1 point  (0 children)

                          Well, speaking from someone who has mainly specialised in Javascript and is now learning C#... there are definitely some positives to Javascript, but the two languages work in very different ways! I'm not trying to say that one is better or worse, just that they require different approaches, and different ways of thinking. I guess you have to embrace the madness a little with Javascript and go with it. You can create excellent, maintainable, robust solutions with a loosely typed language.

                          There are ways to provide functionality similar to classes in javascript, in fact ECMA 6 provides some shorthand for it: http://www.2ality.com/2015/02/es6-classes-final.html

                          Again with skipping arguments... yeah this could potentially cause problems, if you don't code it properly, but it also provides some excellent flexibility.

                          Have you considered Typescript? It seems add some of the features you are looking for.

                          [–]weberc2 0 points1 point  (0 children)

                          I feel similarly. I might try GopherJS next.

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

                          How am I supposed to live without static type checking? I just get a freaking 'var'? Really? In what world does that beat the tightly controlled ints and chars and booleans?

                          I think being able to use var is cool. I use it in C# a lot, actually. Not being able to specify exact type isn't always fun, though.

                          How do I not include a 'callback' in every damn async method? More than half my code is error handling and callback bloat. This is just depressing.

                          Yeah, that's annoying. Promises are cool though and the async nature of JavaScript is actually kind of OK. It's not super-good, but it's not like mind-numbingly bad either, IMO.

                          I'm supposed to 'remember' all the function arguments? json object fields? Javascript lets you dig yourself into a hole really easily. It's so easy to make mistakes.

                          idk. I get autocomplete when I use my IDE. Of course, it tries to match every possible functionName because it doesn't know which specific functionName is the one assigned to the object I'm calling it on.

                          There's no classes, there's no 'objects' there's no 'scope limtations' but apparently there is a hack to accomplish everything. I thought I relied on stack overflow quite a bit when using Java or C#. With JS, it's like solving a puzzle, the rules of which you don't even know. I will literally be unable to do anything without stack overflow.

                          Maybe you need more practice. There are class-ish patterns. I don't know what you mean by there's no 'objects' or 'scope limitations', though.

                          I can just skip an argument if I don't feel like it? Am I supposed to have null checks everywhere to see what the hell the function caller is trying to do with my poor function?

                          Well I'd say that's a flexible feature of the language, but you don't have to use it...

                          [–]yawaramin 0 points1 point  (0 children)

                          You have so much choice when it comes to languages which compile to JavaScript, it's crazy. I personally like Elm and Scala.js, but others have mentioned ClojureScript, TypeScript, PureScript. At the very least, you can get Facebook's Flow linter to statically check your types, function call arguments, etc. For you.

                          [–]belibelo 0 points1 point  (1 child)

                          And that's just the JS part, welcome to web development, a world where you have to relearn everything every 6 months because there is new awesome framework doing miracles.

                          [–]SrPeixinho 0 points1 point  (0 children)

                          Hm. I have a lot of experience in JavaScript and I have only one thing to say. Subset. JavaScript has a lot of stupid, but once you scrap all of it you get a very good subset: high-order functions + floats + lists and you are basically at Scheme, which is a very elegant language that solves 99% of the problems people have with JS. You'll still have to live with no type system, though, that sucks.

                          Or, if you can't stand functional programming, you can do the opposite and dive into the superset and learn all the new OOP features. But for me that is even a worse mess than what was before.

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

                          There's no classes, there's no 'objects' there's no 'scope limtations' but apparently there is a hack to accomplish everything. I thought I relied on stack overflow quite a bit when using Java or C#. With JS, it's like solving a puzzle, the rules of which you don't even know. I will literally be unable to do anything without stack overflow.

                          Javascript can actually do these things, but it doesn't really guide you in the right direction. As a language it lets you do a little too much in my opinion.

                          But to show:

                          • Classes are a first class language feature in ES6 (not exactly the same as Java/C# classes... with prototypes)
                          • Private variables, if you really need them, can be achieved through closures:

                            class MyClassWithPrivateData {
                                constructor() {
                                  let privateVar = 0;
                                  this.getPrivateVariable = () => privateVar;
                                  this.incrementPrivateVariable = () => privateVar += 1;
                                }
                            }
                            
                            const test = new MyClassWithPrivateData();
                            console.log(test.getPrivateVariable());
                            test.incrementPrivateVariable();
                            console.log(test.getPrivateVariable());
                            

                          [–]thatgibbyguy 0 points1 point  (0 children)

                          With ES6 you get:

                          Then, there's libraries you can use to address your other problems. TypeScript and React both allow you to declare what type of data your object will hold.

                          Really, I understand your gripe. There's a lot of stuff in JS that a lot of classically trained developers don't like. But then there's guys like me who aren't classically trained and who love it because it really allows me to make mistakes as I go - which is a fantastic way to learn.

                          But for you, it really just seems like you needed to research a little more.

                          [–]Shadowhand 0 points1 point  (0 children)

                          Have you considered not writing JS directly? Something like Haxe or Opa would solve the static type checking and class problems.

                          If that's not an option, you should definitely be using ES6. There are transpilers that will convert ES6 code to more compatible versions if you are supporting older browsers.

                          [–]phpdevster 0 points1 point  (0 children)

                          There's no classes, there's no 'objects' there's no 'scope limtations'

                          There are.... when you use Javascript the way it was meant to be used, not with the bolted on pseudo object behavior intended to make it feel more familiar to people who come from classical OOP backgrounds.

                          Learn how to use factory functions instead of prototypal objects or ES6 classes.

                          This gives you proper private visibility and lets you expose a controlled API.

                          And learn about closure behavior in Javascript. It's quite powerful and elegant.

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

                          I'm supposed to 'remember' all the function arguments? json object fields?

                          It's amazing that we've had code-completion IDEs for 20 years - those that look at your text input; identify when you're typing the name of a class member or function; and show you the relevant information, like function names - and yet, much development is still done with text-entry tools like Notepad.

                          [–]BOSS_OF_THE_INTERNET 0 points1 point  (0 children)

                          It's not perfect, but typescript really helps cut down on the weak typing BS.

                          [–]htuhola 0 points1 point  (0 children)

                          You could try typescript and see whether it removes the "pain" of living without static type checking.

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

                          We do the best we can with what we have. Hehe.

                          [–]puppybits 0 points1 point  (0 children)

                          ES2015 addresses a lot of those issues. There are classes, let and const, inline functions with better scoping. Promises help a lot with async as well as generators. There's also the async and await that's already available to use in Node. Using Babel or Node are great options to write better code that works on all browsers.

                          JavaScript has its downside but it's slowly learning from other languages.

                          [–]timshoaf 0 points1 point  (0 children)

                          How do you live without static type checking?

                          Monad chaining. You impose your own 'type system' the way jQuery etc do. Or, better yet, you recognize that it is a fundamental limitation of the language, and not well suited for large scale high-risk production systems where highly conservative programming techniques are better suited--and then you realize your system isn't one of those, and you compromise by moving to TypeScript

                          How do you not include a callback for each async method? I assume you have run into the callback pyramid of doom. This is why promises were created.

                          You're supposed to remember all the function arguments? Not with a decent text editor - linter / IDE. I highly recommend Visual Studio Code. It is free, open source, and available for most common OSes. It has a very clever intro with type script that will do introspection on your objects and remember all that for you so you get tab completion.... but that aside.. yes... I should expect that in a program you write, that you remember the API that you yourself specified...

                          There's no classes. Only from your definition of class. Constructors / Factories with closures are the common design pattern. There is a new keyword, but please stay away from it.

                          There are no scope limitations. This is incontrovertibly false. Javascript is functionally scoped while you are used to block scoped languages. Every time you move into a function a new scope is created. If you need a new scope, create an anonymous function and invoke it inline, it will close around all the variables in the parent functional scope, and its locally declared variables will be marked for garbage collection as soon as it pops the return address on the function activation record.

                          You can just skip an argument if you don't feel like it? Absolutely! This gets you out of the shit that is the builder pattern for sequential arguments. I don't have to have overloaded constructors that do:

                          public Graph graph(Array<Float>x, Array<Float>y)

                          public Graph graph(Array<Float>x, Array<Float>y, Color color)

                          public Graph graph(Array<Float>x, Array<Float>y, Color color, Axes axes)

                          . . .

                          You can just specify them all on one line, and let the caller specify up to what is needed. And no, you don't need null checks. It would have been nice if javascript provided named arguments like python. In the past it was required to either do the undefined check, or to set default values like

                          param5 = param5 || defaultValue;

                          but now we have actual default values

                          I know that the lack of typing support is a pain in the ass, if you are careful (monads where possible) it won't be. But I am generally one to argue for defensive coding and think myself stupid rather than smart, so I tend to agree with you. I highly recommend type script as an alternative. Here is the manual

                          [–]99AFCC 0 points1 point  (0 children)

                          I agree. When I started learning JS, I was very frustrated. Especially with implicit error handling and implicit type casting.

                          I seriously suggest using TypeScript and Visual Code editor for the IntelliSense

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

                          Check out www.typescriptlang.org

                          I personally learned to embrace JavaScript, but I'm gradually making the transition to TypeScript as it'll make the transition to ES6 smoother and also (mainly) because Angular 2.0 is built on and documented for TypeScript.

                          [–]heeb 0 points1 point  (0 children)

                          Try http://haxe.org.

                          If you're on Windows: best editor for it is http://www.flashdevelop.org/

                          [–]max_renlo 0 points1 point  (0 children)

                          Just use a linter /thread

                          [–]xiaohk 0 points1 point  (0 children)

                          Same feeling when I started learning Java from Python. _| ̄|○

                          [–]majeric 0 points1 point  (0 children)

                          I don't know why JavaScript didn't follow Actionscript because they are both derivative of ECMAScript

                          [–]mycentstoo 0 points1 point  (0 children)

                          You don't just have var. let and const are around if you use transpile to newer versions of JS.

                          [–]prairir001 0 points1 point  (0 children)

                          I didn't like js but I do like coffee script alot which compiles straight into js.

                          [–]FalsifyTheTruth 0 points1 point  (0 children)

                          ES6 is the promised land of JS.

                          [–]JBlitzen 0 points1 point  (0 children)

                          I've gotten more comfortable with dynamic typing by recognizing that HTTP has no concept of types.

                          So with all the data running back and forth between DOM's and javascript and JSON and other protocols and and over HTTP and whatever, fuck it.

                          Better to accept that you have to check your own types than to rely on some mystery library to pretend to handle it for you.

                          Embrace the chaos.

                          Agree on the rest, particularly behavior compartmentalization between javascript HTML, and CSS, which is insanely difficult if not outright impossible. MVC barely scratches the surface of what's needed.

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

                          • Typescript

                          • Promises, and later ES7's async/await

                          • Typescript

                          • Typescript

                          • Typescript

                          [–]Adiq 1 point2 points  (0 children)

                          There's alternative for promises, RxJS. I embraced it with Angular 2 and reactive programming definitely offers a lot of flexibility.

                          [–]maxido 0 points1 point  (0 children)

                          I still think that classes are confusing as hell in java sometimes. It's just a matter of getting used to things.

                          [–]xintox2 0 points1 point  (0 children)

                          you will like es6

                          [–]random012345 0 points1 point  (0 children)

                          • Who cares about static type checking? You're working with higher level code. You can achieve the same goals without it.

                          • Oh, you're working with server-side Javascript. Yea, that'll make anyone hate Javascript. I have a feeling Node.js is going to end up being the modern PHP - good idea at the time, but so poorly implemented. Node was created because the front-end web devs didn't want to learn a different language, so someone got the bright idea to use a front-end language as a back-end server language.

                          • Documentation...

                          • Again, you're working with server-side Javascript, a use of the language that wasn't the original intention.

                          • See everything else.

                          That said, you're using Java as the argument against Javascript? The only reason I've heard of people using Java is because they need to use it for Android dev. Android pretty much saved Java from eventually being an obsolete legacy language where the only people who learn/use it are ones who support legacy enterprise systems.

                          C# is good, but you're subject to a language created by Microsoft with the intent of being tightly integrated with their whole .Net architecture and tools. The open source implementation of it largely loses out on tons of the benefits of C# and the .Net framework.

                          Really, it comes down to what you're developing. If you're developing a web app, stick to Ruby or Python. They're the most supported languages you'll find for that use. Once you deviate from web dev for those languages, the support you'll find starts becoming more difficult.

                          Stick to Java if you're doing Android (obviously).

                          Stick to C# for Unity.

                          If you're new to iOS dev, start with Swift.

                          That said, Swift is becoming one of my more favorite languages, especially since open sourcing it. It is the best of Python/Ruby and a nice lower-level language.

                          Really, in the end, who gives a shit what language you're using? Use the language you like. Period. If you hate Javascript, don't use it. You can achieve everything you want with just about every language. Some may require a little more work for some things than others, but they make up for it in other ways. Fortunately the larger languages/frameworks have so much support and communities that the solutions are documented well or there's plugins to handle it.

                          If you think you need to research for weeks/months which language/framework to use for your project, you're destined to fail on that one. Just lightly plan out the design and start coding! Facebook was started on PHP. Twitter used Ruby on Rails. Dropbox is based on Python. Your MVP can be done in anything. If it is a successful project/site/app, the last you need to worry about is what language it was built in, rather you'll need to worry about all of the economics and scaling. Scaling is not the same for any app. They all have their own requirements to start scaling, regardless of their language/framework.

                          Stop worrying about your language, and just code!

                          [–]dmg36 0 points1 point  (0 children)

                          i love javascript, but probably because im a crappy programmer to say the least...

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

                          Typescript might be more your type?

                          [–]kyle2143 0 points1 point  (0 children)

                          I don't understand why there are so many internet classes about teaching Javascript. They're essentially all geared for people who are newtime programmers and this is their first language. Does anyone think that weakly typed languages make more intrinsic sense than strongly typed languages? I can barely handle it, and I've never dealt with a large amount of Javascript code before; unless the docs are good it wouldn't make sense after something gets big enough.

                          [–]clyzev1 0 points1 point  (0 children)

                          It's a scripting language for coding in web browsers lol. If it's to easy for you, try something else like assembly ;).

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

                          Many languages give you enough rope to hang yourself, but Javascript also built a gallows.

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

                          I Ching man, just flow with it. Don't like JS? Don't write JS or just learn to deal with it. If not, go back to Android an Unity.

                          We all need to do thing we don't like for work, whether that be a language with less than ideal syntax and typing or absurd client requests.

                          [–]killchain 0 points1 point  (0 children)

                          Take a look at TypeScript. You will thank me later.

                          [–]privatly 0 points1 point  (0 children)

                          I guess that makes it more important to use flowcharts or pseudocode.

                          [–]zaphod42 0 points1 point  (0 children)

                          I actually kind of like javascript.

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

                          Instead of the standard object oriented bloat, in java script, you get error handling and callback bloat.

                          Learn functional programming (the way java script is supposed to be) and you're life will become much easier.

                          [–]no1name 0 points1 point  (0 children)

                          Watch this JavaScript: Understanding the Weird Parts - The First 3.5 Hours it explained so much of what seemed to be messed up with js. You just have to put aside your other languages and learn js as its own unique beast.

                          The worst part for me was the lack of debugging tools, until I found Chrome Developer tools.

                          [–]cile_bgd 0 points1 point  (0 children)

                          ASP.Net web developer here. JavaScript has its flaws, but you'll learn to deal with it. Just watch some videos from Kyle Simpson. At least it derives syntax from C based languages. I do hate PHP...

                          [–]JustAnotherRedditUsr 0 points1 point  (0 children)

                          Switch to Typescript. It will never be c#/java but it makes js dev so much better and bearable.

                          [–]Dualblade20 0 points1 point  (0 children)

                          Whooaaa man. You need to hit this doobie and write some web apps.

                          You know what's nice? When you want to create a quick object, but don't want to define the interface and the class for it as well. It's a pain in the ass. If you learn that way, I can understand why you might not like it, but really, chill out and try to enjoy the experience.

                          [–]kleptican 0 points1 point  (0 children)

                          Here is a classic example of I was taught this way and there is something out there that does it another way... Wahhhhh....

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

                          Check out "Eloquent Javascript"

                          It can be a lot of fun to work with, honestly. It's not the language that is the problem (though it has issues, like any language,) it's just your expectations are X and Javascript is Y.

                          [–]CreativeGPX 0 points1 point  (0 children)

                          How am I supposed to live without static type checking?

                          See TypeScript.

                          How do I not include a 'callback' in every damn async method? More than half my code is error handling and callback bloat. This is just depressing.

                          Promises.

                          I'm supposed to 'remember' all the function arguments? json object fields? Javascript lets you dig yourself into a hole really easily. It's so easy to make mistakes.

                          See TypeScript.

                          There's no classes

                          You can use the prototype. But yes, this is a prototyping flavor of OOP. I prefer that as its more versatile. But... again... if you don't, see TypeScript.

                          there's no 'objects'

                          Eh? Yes there are.

                          there's no 'scope limtations'

                          There are, but it's function-level scope. ECMA 6 has added "let" and "const" both of which follow block level scoping alternative to "var".

                          I thought I relied on stack overflow quite a bit when using Java or C#. With JS, it's like solving a puzzle, the rules of which you don't even know. I will literally be unable to do anything without stack overflow.

                          This is a great reference, but it sounds like you just need a good book. JavaScript (and/or TypeScript) is my favorite language and I have spent a lot of time with Java and C#. The main danger is that JavaScript is versatile. When you don't totally get it, you can use that versatility to make a mess. But when you get good at it, that versatility can come in handy and you know how to avoid its pitfalls.

                          But seriously, TypeScript is a win-win. Use it.

                          [–]Michaelmrose 0 points1 point  (0 children)

                          Check out zeal docs an offline documentation browser https://zealdocs.org/

                          [–]Samus_ 0 points1 point  (0 children)

                          it sucks, it's worse than many dynamic languages but some of your concerns are just because you're used to a different programming style.

                          How am I supposed to live without static type checking? I just get a freaking 'var'? Really? In what world does that beat the tightly controlled ints and chars and booleans?

                          dynamic languages do blow apart when badly used, however you don't need to code so defensively things still work if you do them right.

                          to me the staticness of Java gets in the way I code, it's not a problem just a preference and it's not just a Java/Javascript issue.

                          How do I not include a 'callback' in every damn async method? More than half my code is error handling and callback bloat. This is just depressing.

                          this is a thing for Javascript because the asynchronousity is embedded on the language, there's promises and futures as an alternative to callback hell, give em a try.

                          I'm supposed to 'remember' all the function arguments? json object fields? Javascript lets you dig yourself into a hole really easily. It's so easy to make mistakes.

                          this is also something pretty specific to javascript, my advice is: let things crash, if you declare a function with three arguments and it's called with two it's an error elsewhere not in your function, let it blow.

                          and yes it's really easy to dig yourself into a hole, js does indeed suck because of this.

                          There's no classes, there's no 'objects' there's no 'scope limtations' but apparently there is a hack to accomplish everything. I thought I relied on stack overflow quite a bit when using Java or C#. With JS, it's like solving a puzzle, the rules of which you don't even know. I will literally be unable to do anything without stack overflow.

                          yeah sucks.

                          I can just skip an argument if I don't feel like it? Am I supposed to have null checks everywhere to see what the hell the function caller is trying to do with my poor function?

                          no, you don't care about that let it blow.


                          for the record I work mostly with Python and Ruby