JavaScript aka Mocha aka LiveScript aka JScript aka ECMAScript is one of the worlds most popular programming languages Virtually every personal computer in the world has at least one JavaScript interpreter installed on it and in active use JavaScripts popularity is due entirely to its role as the scripting language of the WWW
JavaScript或者叫 Mocha或者叫 LiveScript或者叫 JScript又或者叫 ECMAScript是世界上最流行的编程语言之一事实上世界上的每一台个人电脑都安装并在频繁使用至少一个JavaScript解释器JavaScript的流行完全是由于他在WWW脚本语言领域中的地位决定的
Despite its popularity few know that JavaScript is a very nice dynamic objectoriented generalpurpose programming language How can this be a secret? Why is this language so misunderstood?
尽管它很流行但是很少有人知道JavaScript是一个非常棒的动态面向对象通用编程语言这居然能成为一个秘密!这门语言为什么被误解如此之深?
The Name
名字
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的子集或简化版的Java看起来最初给它选这个名字是别有用心的是故意混淆概念故意制造误解的JavaScript不是解释执行的JavaJava是解释执行的JavaJavaScript是另外一种语言
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有相似之处这就像Java的语法和C很相像一样但是它不是Java的子集就像Java不是C的子集一样它在Java(Oak)最初打算进军的领域中比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 wasnt confusing enough
JavaScript不是Sun Microsystems的产品Sun是Java的家JavaScript是在Netscape被开发出来的它最初叫LiveScript嗯……还是这个名字好
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后缀让人认为他不是一门真正的编程语言和一门编程语言还有相当的差距但是这只是应用领域的问题和C相比JavaScript是牺牲了性能但换来了丰富的表现力和灵活的形态
Lisp in Cs Clothing
披着C皮的Lisp
JavaScripts Clike 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和函数式语言比如 Lisp 或 Scheme有更多的相似之处而不是和C或Java它使用数组而不是列表使用对象而不是属性列表函数是第一位的它有闭包(closures 怎么翻译??)另外你还可以使用lambda表达式
Typecasting
类型转换
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 nonWebrelated applications
JavaScript最初被设计成在Netscape Navigator中运行它在Navigator中的成功引领它成为事实上所有web浏览器的标准装备这就造就了类型转换JavaScript是编程语言中的 George Reeves(超人)是大量非web程序的称职之选
Moving Target
移动靶
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 objectoriented programming language But many opinions of the language are based on its immature forms
JavaScript的最初几版非常弱没有异常处理没有内部函数和继承现如今它已经成为完全面向对象的编程语言但是这门语言的许多思想是基于它不成熟的形式的
[] []