search
HomeWeb Front-endJS TutorialJavaScript: The world's most misunderstood language

JavaScript, also called Mocha, LiveScript, JScript, ECMAScript, is one of the most popular programming languages ​​in the world. Virtually everyone in the world has at least one JavaScript interpreter installed on their personal computer, and it is widely used. The reason JavaScript is so popular is because of the role it plays as a scripting language on the World Wide Web.

Name

The hint of the prefix Java makes people always associate JavaScript with Java, thinking that JavaScript is a subset of Java or It is a version with worse functionality than Java. It seems that the name JavaScript is intended to cause confusion, and this confusion leads to subsequent misunderstandings. JavaScript is not interpreted as Java, Java is Java. JavaScript is a different programming language.

The syntax of JavaScript is similar to Java, just like Java is similar to C. However, JavaScript is not a subset of Java any more than Java is a subset of C. JavaScript performs better in applications than Java (Oak) was originally intended to do.

JavaScript was not developed at Sun Microsystems, the birthplace of Java, but at Netscape. It was originally called LiveScript, and the name didn't confuse people very much. The hint of the suffix

Script shows that JavaScript is not a real "programming language". As a scripting language, there is still a gap between it and a programming language. However, this is indeed a professional issue. Compared with the C language, JavaScript sacrifices performance in exchange for richer expressiveness and dynamics.

Lisp in C

JavaScript's C-like syntax, including curly braces and bulky for statements, makes it look more like an ordinary Procedural language. This is misleading because JavaScript has more in common with functional languages ​​such as Lisp and Scheme than with C or Java. It uses arrays instead of lists and objects instead of property lists. Functions are of the first type, and functions can have closures. You don't need to balance all those parentheses to use anonymous functions.

Language typing

JavaScript was originally designed to run on Netscape Navigator. Its success has made it de facto standard in all web browsers. This results in the stereotyping of language types. It can be said that JavaScript is the George Reeves of programming languages. JavaScript is also suitable for many applications that have nothing to do with web pages.

Changing (language design) goals

The first version of JavaScript was quite weak. It lacks exception handling, intrinsic functions, inheritance. In its current form, it is a complete object-oriented programming language. However, many of the arguments against the language are based on its immature form.
The ECMA committee responsible for managing the language is developing extensions, which is well-intentioned, but it also exacerbates a larger problem: there are more and more versions. And this caused more confusion.

Design errors

No programming language is perfect. JavaScript also has its own design errors, such as overloading to represent addition and string concatenation with type conversion. The error-prone with statement should also be avoided. The reserved word policy is too strict. The embedding of semicolons is also a huge mistake, as is the notation of regular expressions. These errors can lead to programming errors while calling into question the design of the language as a whole. Fortunately, many of these problems can be mitigated with a very good lint program.

The overall design of this language is quite sound. Surprisingly, the ECMAScript committee seems uninterested in correcting these errors. Perhaps, they are more interested in creating a new language. (Note: This should be a joke from the author).

Poor implementation

Some early implementations of JavaScript were riddled with errors. This is reflected in the language. To make matters worse, these implementations were embedded into even more buggy web browsers.

Bad reference books

Almost all books on JavaScript are pretty bad. They are full of mistakes, inappropriate examples, and unhelpful exercises. Important features in the language are poorly explained or ignored entirely. I have revised many books on JavaScript, but I only recommend one: "The Definitive Guide to JavaScript (Fifth Edition)" - Author: David Flanagan. (Author's note: If you write a good book, please send me a free copy.)

Unqualified standards

JavaScript official Specifications are published by ECMA. The quality of this official specification is quite low. And difficult to read and understand. This is a contributor to the problem of bad books, because authors cannot use standard documentation to improve their understanding of the language. ECMA and the TC39 committee should feel deeply embarrassed and disturbed by this.

Amateur

Many people who use JavaScript are not programmers. They lack the professionalism and training to write good programs. Regardless, JavaScript is so expressive that they can do a lot of meaningful things using JavaScript. This has given JavaScript a reputation, that is to say, JavaScript is a language designed entirely for amateurs and is not suitable for professional programming. Actually, this is not the case.

Object-oriented

Is JavaScript object-oriented? It has objects, and its objects can contain data and methods for processing the data. Objects can contain other objects. It does not have a class, but it has a constructor through which you can do class-like operations, including acting as a container for class variables and methods. It does not have class-oriented inheritance, but it does have prototype-oriented inheritance.

The two main ways to create an object system are through inheritance and through aggregation. JavaScript has both methods, but its dynamic nature makes it even better based on aggregation.

Some argue that JavaScript is not truly object-oriented because it does not support (provide) information hiding. That is, an object cannot have private variables or methods: all members are public.

But there is proof that objects in JavaScript can have private variables and private methods. (Note: In the original article, the author here is a link to the documentation on private variables and private methods of objects) Of course, few people understand this, because JavaScript is the most misunderstood programming language in the world. (Note: The author uses a lighthearted way of ridicule here).

Some argue that JavaScript is not truly object-oriented because it does not support inheritance. But this proves that JavaScript can not only support traditional inheritance but also apply other code reuse patterns. (Note: The original text is still a link here)

Copyright 2001 Douglas Crockford. Copyright Wrrrldwide.

[Recommended course: Javascript video tutorial]

The above is the detailed content of JavaScript: The world's most misunderstood language. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete
Javascript Data Types : Is there any difference between Browser and NodeJs?Javascript Data Types : Is there any difference between Browser and NodeJs?May 14, 2025 am 12:15 AM

JavaScript core data types are consistent in browsers and Node.js, but are handled differently from the extra types. 1) The global object is window in the browser and global in Node.js. 2) Node.js' unique Buffer object, used to process binary data. 3) There are also differences in performance and time processing, and the code needs to be adjusted according to the environment.

JavaScript Comments: A Guide to Using // and /* */JavaScript Comments: A Guide to Using // and /* */May 13, 2025 pm 03:49 PM

JavaScriptusestwotypesofcomments:single-line(//)andmulti-line(//).1)Use//forquicknotesorsingle-lineexplanations.2)Use//forlongerexplanationsorcommentingoutblocksofcode.Commentsshouldexplainthe'why',notthe'what',andbeplacedabovetherelevantcodeforclari

Python vs. JavaScript: A Comparative Analysis for DevelopersPython vs. JavaScript: A Comparative Analysis for DevelopersMay 09, 2025 am 12:22 AM

The main difference between Python and JavaScript is the type system and application scenarios. 1. Python uses dynamic types, suitable for scientific computing and data analysis. 2. JavaScript adopts weak types and is widely used in front-end and full-stack development. The two have their own advantages in asynchronous programming and performance optimization, and should be decided according to project requirements when choosing.

Python vs. JavaScript: Choosing the Right Tool for the JobPython vs. JavaScript: Choosing the Right Tool for the JobMay 08, 2025 am 12:10 AM

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript: Understanding the Strengths of EachPython and JavaScript: Understanding the Strengths of EachMay 06, 2025 am 12:15 AM

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScript's Core: Is It Built on C or C  ?JavaScript's Core: Is It Built on C or C ?May 05, 2025 am 12:07 AM

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript Applications: From Front-End to Back-EndJavaScript Applications: From Front-End to Back-EndMay 04, 2025 am 12:12 AM

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Python vs. JavaScript: Which Language Should You Learn?Python vs. JavaScript: Which Language Should You Learn?May 03, 2025 am 12:10 AM

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools