JavaScript,是世界上最流行的编程语言之一
Despite its popularity, few know that JavaScript is a very nice dynamic object-oriented general-purpose programming language. How can this be a secret? Why is this language so misunderstood?
尽管它很流行,但是很少有人知道JavaScript是一个非常棒
The Java- prefix suggests that JavaScript is somehow related to Java, that it is a subset or less capable version of Java. It seems that the name was intentionally selected to create confusion, and from confusion comes misunderstanding. JavaScript is not interpreted Java. Java is interpreted Java. JavaScript is a different language.
Java- 前缀很容易使人联想到Java,并认为它是Java的子集或简化版
JavaScript has a syntactic similarity to Java, much as Java has to C. But it is no more a subset of Java than Java is a subset of C. It is better than Java in the applications that Java (fka Oak) was originally intended for.
JavaScript的语法和Java有相似之处
JavaScript was not developed at Sun Microsystems, the home of Java. JavaScript was developed at Netscape. It was originally called LiveScript, but that name wasn't confusing enough.
JavaScript不是Sun Microsystems的产品,Sun是Java的家
The -Script suffix suggests that it is not a real programming language, that a scripting language is less than a programming language. But it is really a matter of specialization. Compared to C, JavaScript trades performance for expressive power and dynamism.
-Script后缀让人认为他不是一门真正的编程语言,和一门"编程语言
Lisp in C's Clothing
披着C皮的LispJavaScript's C-like syntax, including curly braces and the clunky for statement, makes it appear to be an ordinary procedural language. This is misleading because JavaScript has more in common with functional languages like Lisp or Scheme than with C or Java. It has arrays instead of lists and objects instead of property lists. Functions are first class. It has closures. You get lambdas without having to balance all those parens.
JavaScript的类C语法,包括大括号和语句的形式
JavaScript was designed to run in Netscape Navigator. Its success there led to it becoming standard equipment in virtually all web browsers. This has resulted in typecasting. JavaScript is the George Reeves of programming languages. JavaScript is well suited to a large class of non-Web-related applications
JavaScript最初被设计成在Netscape Navigator中运行,它在Navigator中的成功引领它
The first versions of JavaScript were quite weak. They lacked exception handling, inner functions, and inheritance. In its present form, it is now a complete object-oriented programming language. But many opinions of the language are based on its immature forms.
JavaScript的最初几版非常弱,没有异常处理
The ECMA committee that has stewardship over the language is developing extensions which, while well intentioned, will aggravate one of the language's biggest problems: There are already too many versions. This creates confusion.
ECMA委员会,这门语言的管家,正在对它进行扩展,也在蓄意恶化它最大的问题
No programming language is perfect. JavaScript has its share of design errors, such as the overloading of + to mean both addition and concatenation with type coercion, and the error-prone with statement should be avoided. The reserved word policies are much too strict. Semicolon insertion was a huge mistake, as was the notation for literal regular expressions. These mistakes have led to programming errors, and called the design of the language as a whole into question. Fortunately, many of these problems can be mitigated with a good lint program.
没有什么编程语言是完美的。JavaScript也有它设计上的错
The design of the language on the whole is quite sound. Surprisingly, the ECMAScript committee does not appear to be interested in correcting these problems. Perhaps they are more interested in making new ones.
这门语言的整体设计(上的问题)是相当明显的。奇怪的是ECMAScript委员
Some of the earlier implementations of JavaScript were quite buggy. This reflected badly on the language. Compounding that, those implementations were embedded in horribly buggy web browsers.
JavaScript的一些早期实现有许多bug
Nearly all of the books about JavaScript are quite awful. They contain errors, poor examples, and promote bad practices. Important features of the language are often explained poorly, or left out entirely. I have reviewed dozens of JavaScript books, and I can only recommend one: JavaScript: The Definitive Guide (4th Edition) by David Flanagan. (Attention authors: If you have written a good one, please send me a review copy.)
几乎所有的JavaScript书都是相当可怕的。它们包含错误
ECMA에서 발행한 공식 사양입니다. 사양의 품질이 매우 낮고 읽기가 매우 어렵습니다. 이는 작성자가 사용할 수 없기 때문에 Bad Book 문제의 원인이 되었습니다. ECMA와 TC39 위원회는 언어에 대한 이해를 높이기 위해 표준 문서를 작성해야 합니다.
ECMA에서 발표한 공식 언어 사양의 품질은 매우 낮습니다. 읽기 어려울 뿐만 아니라 이해하기도 매우 어렵습니다. 이는 이러한 "나쁜 책"에 큰 기여를 합니다. 왜냐하면 해당 저자는 언어에 대한 더 깊은 이해를 얻기 위해 이 표준 문서를 사용할 수 없기 때문입니다. ECMA와 TC39는 이에 대해 매우 당황스러워해야 합니다.
좋은 프로그램을 작성하기 위한 교육이 부족합니다. JavaScript는 표현력이 매우 뛰어나
어쨌든 유용한 작업을 수행하는 데 사용할 수 있습니다. 이로 인해 JavaScript는 "전문 프로그래머가 아닌 아마추어에게 완벽하게 적합하다"는 평판을 얻었습니다. 이는 명백한 실수입니다
객체 지향
. 클래스는 없지만 클래스 변수 및 메서드 선언을 포함하여 클래스 작업을 수행하는 생성자가 있습니다. 클래스 지향 상속은 없지만 프로토타입 지향 상속은 있습니다.
집계보다 더 나은 구현이 가능합니다.
와 개인 메서드가 없습니다. 모든 멤버는 공개입니다.
어떤 사람들은 JavaScript가 상속을 제공하지 않기 때문에 진정한 객체 지향이 아니라고 주장합니다. 그러나 JavaScript는 기존 상속뿐만 아니라 다른 코드 재사용 패턴도 지원하는 것으로 나타났습니다.
JavaScript가 진정한 객체 지향이 아니라는 또 다른 주장은 상속을 제공하지 않는다는 것입니다. 그러나 사실 JavaScript는 고전적인 상속을 지원할 뿐만 아니라 다른 코드 재사용 패턴도 지원합니다.
http://www.crockford.com/javascript/javascript.html
중국어 번역 주소:
http://blog.csdn.net/uoyevoli/archive/2006/05/19/744915.aspx번역자: Yuan Xiaohui