Ranked in these QuestionsQuestion Ranking
Pro Required for web development
Pro No installation required
Pro Runs on both the browser and the server
Pro First-class functions with lexical closures
Pro Easy to build an application
By using the UI capabilities in HTML and CSS you can develop substantial applications with graphical interfaces more quickly and with less effort than in other languages which would require you to learn a windowing library.
Building a useful application is one of the best ways to learn a new language and because of the low learning curve for creating applications you can create more substatial programs and learn more practical programming priciple faster.
Pro Massive ecosystem
Pro Instant gratification
Pro C-like syntax
Pro Very good debugger
Has a built in debugger with break points, watches that work on local values, and a console that you can use to edit anything at any time. Both in the browser (eg: Chrome), and server (eg: Nodejs).
Pro Complete dev stack can be run online
Pro JSON is native to JS
JSON is arguably a "must-learn". With JS, that's one less additional syntax to learn.
Pro Great tools for development
Flow, JSHint/ESLint, Babel, npm, etc.
Pro Several Platforms to use the web stack and JS to create multi-platform apps
Opens the door to native application development as well as just websites. Use with React Native, Weex or Quasar (Vue), PhoneGap or Cordova, NativeScript... (etc) to build native apps. Use mostly the same code base for multi-platform and web.
Pro Can be very simple (teachable)
By setting a few ground-rules (effectively coding in a subset of JS), JS is one of the simplest languages to learn (requiring very few must-learn prerequisite concepts).
May also be a con.
Pro Modern ESNext is far better than the JS of days past
Modern JS has made great strides, and can be targerted to older (or non-standard) browsers using Babel. There are new language constructs that can make programming in JS comfortable.; e.g.: async / await ( <3 ).
Pro Speed (most implementations)
JS/ES is in the running for the fastest interpreted language given the optimizations and JIT integration of popular implementations. On the other hand, it fails utterly when compared with compiled (to native or VM code) languages.
Pro Integrates very well with UE4
Coding an immersive 3D game can retain the attention of new programmers. ncsoft/Unreal.js.
Pro Prototype based Object Oriented System
For example, in a prototypical language, you think of a rectangle, and define it. You now have a rectangle. Let's say you want a red rectangle, you copy the rectangle and give it the property red. Want a blue one? Copy rectangle again give it a blue. Big blue rectangle? Copy blue rectangle and make it big. In a class-based language, first you describe a rectangle, describe a red rectangle as a type of rectangle, describe blue and big blue rectangles, and now that you have described them, you must create instances of them, and only then do you have the rectangles. Essentially: Classes are factories for objects, prototypes are objects themselves, and the latter method was created to be more intuitive, which is particularly advantageous to beginners.
Pro Extremely popular
Pro The most used language in the whole Solar System in amount of scripts/applications
Because it runs in many different environments, it is the most used language in the world.
Pro Great async language support
Dart is a single threaded programming language. So if any piece of code blocks the execution of the program, the program practically freezes. To avoid this Dart makes use of asynchronous operations which let your program run without getting blocked. This is done through Future objects.
A Future is an object which represent a means for getting a value at a certain point in the future. A function may invoke a Future and when that happens, two outcomes can be achieved:
- The function is unable to return a value, so it queues up work to be done and returns an uncompleted Future object.
- Or later when a value is available to be returned, the Future object completes with that value.
Pro Great standard library
Dart includes a truly comprehensive core library, making it unnecessary to include disparate, external resources for basic functionalities Other than reducing the need to pull in various 3rd-party utilities this also ensures that all Dart code looks and feels the same.
Out of the box, the developer gets core libraries to help with: async, collections, strings, regexps, conversions, formats, file I/O, math, typed data, and more.
Pro No compile time in development
Dartium (Chromium derivative) is a browser with integrated Dart VM, which allows you to run and debug native Dart code during development for short edit-reload cycles. Only for testing on other browsers and deployment is transpiling to JS necessary.
Pro A lot of tools are available to help in developing with Dart
Dart has a lot of tools available which help with developing Dart applications. Some examples of those tools include:
- pub - package and dependency management and build tool
- analyzer - static syntax analysis with linter, quick fixes, autocompletion support for easy IDE integration
- test - powerful and flexible testing framework and test runner
- dev_compiler - generate reusable JS instead of tree-shaken minified JS output (work in progress)
- dartfmt_ - source code formatter
- server-side VM
- observatory - a powerful tool for profiling and debugging running Dart code (for Dartium and Dart server code)
In Dart many browser differences (subtle differences and also missing features) are abstracted away or polyfilled. When Dart is transpiled to JS the output works on all supported browsers. There is usually no need to load polyfills or to consider browser differences during development. No need for libraries like jQuery to make the same code work the same on all browsers.
Pro Will be familiar to Java developers
The language will look familiar to Java developers, easing the learning curve.
And yet, while it's similar, it has some nice syntax facilities to avoid common boilerplate code found in Java. Code is terser, yet readable.
Pro Easy prototyping
Dart has an optional type system which makes Dart a great language for prototyping. It encourages developers to gradually evolve their programs without worrying about types first.
Pro Can compile to efficient machine code
Dart was designed to be as expressive as possible. Ahead-of-time compilers can compile Dart code to efficient machine code. This is especially important when deploying to mobile where you don't want (or can't) use a JIT.
Pro AngularDart 2.0 support
Pro Optional strong mode.
Strong mode applies a more restrictive type system to Dart to address its unsound, surprising behavior in certain cases.
Pro Support of semi-coroutines (generators)
Generators, also known as semicoroutines, are also a generalization of subroutines.
Generators are primarily used to simplify the control of iteration behavior of a loop, the
yield statement in a generator passes a value back to a parent routine.
A generator is very similar to a function that returns an array, in that a generator has a certain number of values. But instead of building and returning an array that contains all the wanted values, a generator returns them one at a time, this saves memory and allows the caller function to start processing the first few values immediately.
Con Many errors pass silently
Con Easy to accidentally use globals
If you forget a
Con The "this" keyword doesn't mean what you think it means
this is bound to whatever object called the function. Unless you invoke it as a method. Unless you invoke it as a constructor. Unless it's an arrow function.
Con Does not teach you about data types
Con Weird type coercions
'5' - 1 == 4, but
'5' + 1 == 51. There are other examples that make even less sense.
Con Asynchronous coding is not easy for beginners
Con Each browser has its own quirks when executing the same code in some cases
Beginner programmers often make the mistake of coding something, seeing it works in the browser they tested it in, and then scratching their heads when it doesn't work in another browser. Ideally you'd want a language that works consistently across all platforms in order to be able to focus more on the programming and less on the underlying environment. It just takes time away from learning and forces you to spend time figuring out why this worked in browser X but not browser Y.
Con Limited standard library
Much often needed functionality is not in the standard library. (Contrast with Python.) However, there are well established libraries such as Lodash, to fill the gap (however, due to the diverse/fractured ecosystem it may not be clear what library to use).
Con The `null` and `undefined` objects aren't really objects
Therefore, attempts to call methods on them will fail. This is especially frustrating since these are often returned instead of throwing exceptions. So a failure may appear far away from the actual cause, which makes bugs very hard to find.
Con Array-like objects
Many cases when you should get an Array, you just get an Array-like object instead and none of the Array methods work on it.
Con Fast moving
The language and the web platform move fast these days. this makes it difficult for students as there is a lot of fragmentation and outdated information.
Con Numbers that begin with 0 are assumed octal
This is very surprising for beginners. Especially since
07 seem to work just fine. And this isn't just for hardcoded numbers. The
parseInt() function has the same problem, but only on some systems.
Con The constant churn of tooling and language
Con Many tutorials, code, and resources, are structured for older ES5 code
Con Easy to fall into bad manners and bad mind structure
It wouldn't consolidate a good mind structure for moving to other languages. Too open.
Con Good tools are pretty much a MUST for new programmers
You really want to be using a good editor (light IDE) and a linter, type checker (e.g.:Flow), etc. until you grok the language. And choosing / setting-up that development environment is it's own learning curve. If taught in a classroom, using a subset of JS with solid tools, there is an argument that JS could be an ideal first language... however, that is a lot of ceremony to protect the new programmer from JS gotchas. But without the tools, JS can be a very painful painful first language (trying to figure out why your code isn't doing what you intended).
Con Very confusing to read
Con Has really bad parts you're better off avoiding altogether
Con Counter-intuitive type conversion
3+5; // 8; "Hello "+"world"; // "Hello world"
+ with a string and a non-string operand, the non-string operand is converted to a string and the result is concatenated:
"the answer is "+42; // "the answer is 42" "this is "+true; // "this is true"
In any other case (except for Date) the operands are converted to numbers and the results are added:
1+true; // = 1+1 = 2; null+false; // = 0+0 = 0;
Con Fractured ecosystem
Angular, React, Ember, Meteor, Backbone, Knockout, Express, Mithril, Aurelia. The web frameworks pass in and out of fashion too quickly to keep up with. The endless civil wars are becoming tiresome.
Con Dart SDK does not provide standard (out of the box) way to access SQL-based databases on server side
This missing (but very popular) feature requires to use 3rd-party packages developed by the personal enthusiasts or very small groups of enthusiasts, which is not very convenient because they are all very fragmented in terms of content, the essence and capabilities.
Con Small community, little momentum