Ranked in these QuestionsQuestion Ranking
Pro No installation required
Pro Required for web development
Pro Runs on both the browser and the server
Pro Instant gratification
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 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 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 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).
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.
May also be a con.
Pro Speed (most implementations)
JS/ES is in the running for the fastest interpreted language given the optimizations and JIT integration of popular implementations.
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 Integrates very well with UE4
Coding an immersive 3D game can retain the attention of new programmers. ncsoft/Unreal.js.
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 Built-in formal specificaiton
ATS has a theorem-proving type system powerful enough to prove that its functions meet their specifications. This happens at compile time with no performance impact at runtime. This can be used to prove that an ATS program doesn't have bugs commonly found in C++ programs, like "this function never leaks memory" or "this program never attempts to divide by zero" or "this buffer never overflows" or to verify pointer arithmetic, etc.
Pro Free and open-souce compiler
The compiler (ATS/Postiats) is GPLv3.
Pro Funcitonal programming
The syntax is ML-like with the usual functional language features like pattern matching and tail-call optimization.
Pro High-performance systems language
ATS works as a low-level systems language. ATS programs have performance and footprint comparable to programs written in C/C++.
Pro Good module system
Similar to Modula-3. This makes ATS a viable choice even for large-scale projects.
Pro Safe concurrency
ATS can prove its concurrent programs have no deadlocks or race conditions.
Con Many errors pass silently
Con Easy to accidentally use globals
If you forget a
Con Weird type coercions
'5' - 1 == 4, but
'5' + 1 == 51. There are other examples that make even less sense.
Con Does not teach you about data types
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 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 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 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 Dependency on browser developer(s)
This works in Chrome and IE:
And this works in FireFox and Chrome and IE:
You're also unable to use some of the less-popular CSS3 features in one browser versus the other. Can't give a detailed list due to ongoing development.
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 Asynchronous coding is not easy for beginners
Con Inconsistent operators
"" == 0 is
0 == "0" is
"" == "0" is
Con Many tutorials, code, and resources, are structured for older ES5 code
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 No "clear choice" frameworks/libraries
The closest JS gets (IMHO) is jQuery for consistent DOM api. From libraries to fill the hole left by no comprehensive standard library (eg: lodash, underscore, ramda, functionaljs, sugar, core-js, stdlib, locutus, or the N implementations of range or pad on npm), to front-end frameworks (angular, aurelia, vue, react, ember, polymer, etc), and everything in between; the JS ecosystem is hugely diverse and there is rarely a "major" library or framework for a given purpose.
This is overwhelming for a new user. While diversity is good, at least having a major/primary library/framework for a given need/use is highly desirable for a "learn this first"language in order to be productive and focused (not to mention finding fast and accurate help from the community).
Con The constant churn of tooling and language
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 No Windows version
But it does run on Cygwin.