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的最初幾版非常弱沒有異常處理沒有內部函數和繼承現如今它已經成為完全面向對象的編程語言但是這門語言的許多思想是基於它不成熟的形式的
[] []
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20721.html