What's the best way to write JavaScript?

created by eric 6 months ago
  • TypeScript

    • eric
      eric6 months ago

      strongly typed. This makes it much easier to rationalize about a FE codebase

      • jroberts
        jroberts5 months ago

        The only way to make JS feel like a real language

        • redvixen
          redvixen5 months ago

          True IDE support, not just syntax highlighting

          • jeffworks
            jeffworks5 months ago

            The main benefit here is that productivity is greatly improved because you can catch errors at the IDE level without having to compile, run in browser, and debug in browser

            • terri
              terri5 months ago

              ES6 and ES7 transpiler built in

              • Yoreck
                Yoreck5 months ago

                Basic advantage - it allow LESS for developer. Most ES6, ES5 etc code is spaghetti. TS complain about everything and that's great. At least juniour devs should learn ts BEFORE javascript, nowerdays.

                • Thynctank
                  Thynctank5 months ago

                  There's one thing I was talking about the other day in CoffeeScript I wish existed elsewhere: annotated regex, which let's you use normal regex syntax across multiple lines without stringifying, and you can add comments next to each unusual/complex section of your pattern. I'm a fan of CoffeeScript terseness and indentation, as well as its general rubyishness, but I realize it's not for everyone, and it may make little sense to use it in a large team especially for difficulty in hiring devs who even want to work on it, let alone have the experience. (I mean CS isn't ridiculously big in feature set scope, but familiarity when working on a big codebase in particular is a big help) All that said, I think TypeScript wins out, not the least simply due to exposure/MS backing, and because it's a superset rather than a port, which means more people can work on it already. TypeScript is awesome from the tiny bit I've worked on primarily because 1) because you can add it in installments, modifying your lint configs as you do so, and 2) annotations and enforcement (again on a sliding scale of detail)

                  • Roberto
                    Roberto4 months ago

                    Awesome IDE support

                    • mathuranubhav
                      mathuranubhav4 months ago

                      Everyone seems to be doing it.

                      • kanpinar
                        kanpinar4 months ago

                        10+ Developer using TypeScript sourcecode that i propared for them for a kick start they done well... 3 years and still working AWESOME.

                        • anandchakru
                          anandchakru4 months ago

                          Type safety, finally!

                          • polatengin
                            polatengin4 months ago

                            it's more OOP and easier to transform knowledge from OOP languages, such as C#

                          • ES6

                            • eric
                              eric6 months ago

                              w3c standard

                              • eric
                                eric6 months ago

                                no transpiler needed

                                • jamesleebaker
                                  jamesleebaker6 months ago

                                  Ease of use

                                  • xavierartot
                                    xavierartot5 months ago

                                    Short syntax, elegant, clear.

                                    • karakarakaraff
                                      karakarakaraff4 months ago

                                      I learned yesterday at the meeting with other coders that ES6 comes in especially handy with React, which I had kind of picked up on my own. So, out of curiosity, I spent some time today reading about React+ES6.

                                      • ssan
                                        ssan2 months ago

                                        I may not like some of the syntactic sugar but I understand where people are coming from. With that said, TS is a waste of time and if you have TDD + linting and any decent editor, TS quickly becomes an overhead that is not worth it. Learn the language (JS), love it, appreciate it, explore it. Do not run away from it by going superset. It is a waste of time.

                                      • ES5

                                        • eric
                                          eric6 months ago

                                          w3c standard

                                          • eric
                                            eric6 months ago

                                            All browsers can support it without n ES6 transpiler like Babel

                                            • isaac
                                              isaac5 months ago

                                              ES5 is perfect as it is. ES6 is just syntactic sugar.

                                              • eric
                                                eric5 months ago

                                                Never had a need to move off of ES5

                                              • CoffeeScript

                                                • techdad
                                                  techdad6 months ago

                                                  great for folks familiar with ruby syntax

                                                  • S37H
                                                    S37H4 months ago

                                                    So nobody wants to hear this, but CoffeeScript is the most functional language you can use on both the front and back ends of a web application. Back from the dead?

                                                  • Elm

                                                    • leojpod
                                                      leojpod5 months ago

                                                      Real compiler, real type-system, IDE support (checkout elm-jutsu if you don't trust me), ...

                                                      • leojpod
                                                        leojpod5 months ago

                                                        Plus: thanks to the real type-system and the solid compiler it's actually super easy to grow/refactor your code as you go.

                                                        • greim
                                                          greim4 months ago

                                                          Reason #433 why I'd rather program in Elm: JavaScript silently coerces null values to zero in mathematical operations. I've memorized the coercion rules multiple times, but this nevertheless just cost me half a day.