Home Web Front-end JS Tutorial JavaScript: The world's most misunderstood language

JavaScript: The world's most misunderstood language

Nov 23, 2016 am 11:19 AM
javascript

 JavaScript, or Mocha, or LiveScript, or JScript, or ECMAScript, is one of the most popular programming languages ​​in the world. Virtually every personal computer in the world has at least one JavaScript interpreter installed and actively used. The popularity of JavaScript is entirely due to its status in the field of WWW scripting languages.

JavaScript: The worlds most misunderstood language

Despite its popularity, few people know that JavaScript is a great dynamic object-oriented general-purpose programming language. This can actually become a secret! Why is this language so misunderstood?

 Name

 Java- The prefix can easily make people think of Java and think it is a subset of Java or a simplified version of Java. It seems that the name was originally chosen for it with ulterior motives, to deliberately confuse concepts and create "misunderstandings". JavaScript is not interpreted Java. Java is interpreted Java. JavaScript is another language.

 The syntax of JavaScript is similar to Java, just like the syntax of Java is very similar to C. But it's not a subset of Java, just like Java is not a subset of C. It's better than Java in the areas that Java (Oak) was originally intended to go into.

 JavaScript is not a product of Sun Microsystems, Sun is the home of Java. JavaScript was developed at Netscape. It was originally called LiveScript, well... that's still a good name.

 -Script suffix makes people think that it is not a real programming language, and there is still a considerable gap between it and a "programming language". But this is only a matter of application domain. Compared with C, JavaScript sacrifices performance in exchange for rich expressiveness and flexible form.

  Lisp in C skin

JavaScript’s C-like syntax, including the form of braces and statements, makes it look like an ordinary process-oriented programming language. This is a misunderstanding, because JavaScript has more in common with functional languages, such as Lisp or Scheme, than with C or Java. It uses arrays instead of lists, and objects instead of property lists. The function comes first, it has closure (how to translate closure??), and you can also use lambda expressions.

  Type Conversion

JavaScript was originally designed to run in Netscape Navigator, and its success in Navigator led it to become standard equipment in virtually all web browsers. This creates "type conversion". JavaScript is the George Reeves (Superman) of programming languages ​​and is a competent choice for a large number of non-web programs.

  Moving target

  The first few versions of JavaScript were very weak, with no exception handling, no internal functions and no inheritance. Today, it has become a fully object-oriented programming language. But many ideas in the language are based on its immature form.

 The ECMA committee, the stewards of the language, is expanding it and deliberately exacerbating its biggest problem: too many versions. This is a source of confusion.

 Design errors

 No programming language is perfect. JavaScript also has its design errors, such as the overloaded + sign that means both "addition" and "connection" depending on the type, and the error-prone with statement that should be avoided. Its reserved word policy is too strict. The insertion of a semicolon is a huge mistake, for example when used as the symbol for a literal regular expression. These missteps have led directly to errors in programming and have called into question the overall design of the language. Fortunately, many of these problems can be mitigated with a good lint program.

 The overall design of this language is quite obvious. The strange thing is that the ECMAScript committee has not shown much interest in fixing existing problems, perhaps they are more interested in creating new ones.

 Poor Implementation

 Some early implementations of JavaScript had many bugs, which in turn had a very bad impact on the language itself. What's even worse is that these buggy implementations are embedded in buggy web browsers.

  Bad books

Almost all JavaScript books are pretty terrible. They contain errors, contain bad examples, and encourage bad practice. Some important features of the JavaScript language are either not explained clearly or not mentioned at all. I have read many JavaScript books, but I can only recommend one: JavaScript: The Definitive Guide (4th Edition) by David Flanagan. (Note to authors: If you write a good book, please send me a copy and I will proofread it for you.)

 Standards of “quasi-standards”

 The quality of the official language specifications published by ECMA is extremely poor. Not only difficult to read but extremely difficult to understand. It has contributed a lot to the "bad books" whose authors were unable to gain a deeper understanding of the language through this standard document. ECMA and TC39 should be very embarrassed about this.

 Amateurs

 Most people who use JavaScript are not programmers. They lack the training and training to write good programs. JavaScript is very expressive and they can do useful things with it anyway. This has given JavaScript a reputation as being more for amateurs than professional programmers. This is obviously a mistake.

 Object-oriented

 Is JavaScript object-oriented? It has objects, and its objects can contain data and methods for operating on the data. Objects can also contain other objects. It does not have classes, but it has constructors to do class things, including declaring class variables and methods. It does not have class-oriented inheritance, but it has prototype-oriented inheritance.

 The two main methods of building object systems are inheritance (is-a) and aggregation (has-a). JavaScript has both, but its dynamic nature allows for better implementations than aggregation.

Some arguments that JavaScript is not really object-oriented are based on the fact that it does not provide information hiding. In other words, a JavaScript object has no private variables or methods: all its members are public.

 But the fact is that JavaScript objects can have private variables and private methods (click here to see how to do this). Of course, the reason so few people know this is because JavaScript is the most misunderstood language in the world.

Another argument that JavaScript is not really object-oriented is that it does not provide inheritance. But the fact is that JavaScript not only supports classic inheritance, but also supports other code reuse patterns.

 Translation: Yuan Xiaohui Original link: http://www.crockford.com/javascript/javascript.html


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

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 Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement an online speech recognition system using WebSocket and JavaScript How to implement an online speech recognition system using WebSocket and JavaScript Dec 17, 2023 pm 02:54 PM

How to use WebSocket and JavaScript to implement an online speech recognition system Introduction: With the continuous development of technology, speech recognition technology has become an important part of the field of artificial intelligence. The online speech recognition system based on WebSocket and JavaScript has the characteristics of low latency, real-time and cross-platform, and has become a widely used solution. This article will introduce how to use WebSocket and JavaScript to implement an online speech recognition system.

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems WebSocket and JavaScript: key technologies for implementing real-time monitoring systems Dec 17, 2023 pm 05:30 PM

WebSocket and JavaScript: Key technologies for realizing real-time monitoring systems Introduction: With the rapid development of Internet technology, real-time monitoring systems have been widely used in various fields. One of the key technologies to achieve real-time monitoring is the combination of WebSocket and JavaScript. This article will introduce the application of WebSocket and JavaScript in real-time monitoring systems, give code examples, and explain their implementation principles in detail. 1. WebSocket technology

How to use JavaScript and WebSocket to implement a real-time online ordering system How to use JavaScript and WebSocket to implement a real-time online ordering system Dec 17, 2023 pm 12:09 PM

Introduction to how to use JavaScript and WebSocket to implement a real-time online ordering system: With the popularity of the Internet and the advancement of technology, more and more restaurants have begun to provide online ordering services. In order to implement a real-time online ordering system, we can use JavaScript and WebSocket technology. WebSocket is a full-duplex communication protocol based on the TCP protocol, which can realize real-time two-way communication between the client and the server. In the real-time online ordering system, when the user selects dishes and places an order

How to implement an online reservation system using WebSocket and JavaScript How to implement an online reservation system using WebSocket and JavaScript Dec 17, 2023 am 09:39 AM

How to use WebSocket and JavaScript to implement an online reservation system. In today's digital era, more and more businesses and services need to provide online reservation functions. It is crucial to implement an efficient and real-time online reservation system. This article will introduce how to use WebSocket and JavaScript to implement an online reservation system, and provide specific code examples. 1. What is WebSocket? WebSocket is a full-duplex method on a single TCP connection.

JavaScript and WebSocket: Building an efficient real-time weather forecasting system JavaScript and WebSocket: Building an efficient real-time weather forecasting system Dec 17, 2023 pm 05:13 PM

JavaScript and WebSocket: Building an efficient real-time weather forecast system Introduction: Today, the accuracy of weather forecasts is of great significance to daily life and decision-making. As technology develops, we can provide more accurate and reliable weather forecasts by obtaining weather data in real time. In this article, we will learn how to use JavaScript and WebSocket technology to build an efficient real-time weather forecast system. This article will demonstrate the implementation process through specific code examples. We

Simple JavaScript Tutorial: How to Get HTTP Status Code Simple JavaScript Tutorial: How to Get HTTP Status Code Jan 05, 2024 pm 06:08 PM

JavaScript tutorial: How to get HTTP status code, specific code examples are required. Preface: In web development, data interaction with the server is often involved. When communicating with the server, we often need to obtain the returned HTTP status code to determine whether the operation is successful, and perform corresponding processing based on different status codes. This article will teach you how to use JavaScript to obtain HTTP status codes and provide some practical code examples. Using XMLHttpRequest

How to use insertBefore in javascript How to use insertBefore in javascript Nov 24, 2023 am 11:56 AM

Usage: In JavaScript, the insertBefore() method is used to insert a new node in the DOM tree. This method requires two parameters: the new node to be inserted and the reference node (that is, the node where the new node will be inserted).

JavaScript and WebSocket: Building an efficient real-time image processing system JavaScript and WebSocket: Building an efficient real-time image processing system Dec 17, 2023 am 08:41 AM

JavaScript is a programming language widely used in web development, while WebSocket is a network protocol used for real-time communication. Combining the powerful functions of the two, we can create an efficient real-time image processing system. This article will introduce how to implement this system using JavaScript and WebSocket, and provide specific code examples. First, we need to clarify the requirements and goals of the real-time image processing system. Suppose we have a camera device that can collect real-time image data

See all articles