Ranked in these QuestionsQuestion Ranking
Pro First-class functions with closures
Pro Required for web development
Pro No installation required
Pro Runs on both the browser and the server
Pro Extremely popular
Pro Instant gratification
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 Great ecosystem
Pro C-like syntax
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 Use with React Native to build native apps as well as websites
Opens the door to native application development as well as just websites.
Pro Employment is easy to find
Pro Complete dev stack can be run online
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.
Con Has really bad parts you're better off avoiding altogether
Con Many errors pass silently
Con Inconsistent 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 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 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 Does not teach you about data types
Con Limited standard library
Much often needed functionality is not in the standard library. (Contrast with Python.)
Con Unstable ecosystem
Con Weird type coercions
'5' - 1 == 4, but
'5' + 1 == 51. There are other examples that make even less sense.