mozilla

Compare Revisions

About JavaScript

Change Revisions

Revision 6619:

Revision 6619 by Sonrisa on

Revision 6620:

Revision 6620 by Sonrisa on

Title:
About JavaScript
About JavaScript
Slug:
JavaScript/About_JavaScript
JavaScript/About_JavaScript
Tags:
javascript
javascript
Content:

Revision 6619
Revision 6620
n8      什麼是 JavaScript?n8      What is JavaScript?
n11      <span class="external">JavaScript</span><sup>® &nbsp;</sup>n11      <span class="external">JavaScript</span><sup>®</sup>&nbsp;i
>是被用在上百萬的網頁和伺服器應用程式的一種網景開發物件腳本語言。Netscape's JavaScript是ECMA-262 Ed>s the Netscape-developed object scripting language used in millio
>ition 3 (<a href="/en/JavaScript/Language_Resources" title="en/EC>ns of web pages and server applications worldwide. Netscape's Jav
>MAScript">ECMAScript</a>)的基礎標準腳本語言,兩者之間<span>從</span><span>公佈的標準<>aScript is a superset of the ECMA-262 Edition 3 (<a href="/en/Jav
>/span><span>只有輕微</span><span>的</span><span>差異</span><span>。</span>aScript/Language_Resources" title="en/ECMAScript">ECMAScript</a>)
>>> standard scripting language, with only mild differences from the
 > published standard.
n14      相對於常見的誤解,<span>JavaScript</span><span>不是</span><span class=n14      Contrary to popular misconception, JavaScript is not "Inter
>"atn">“</span><span>解釋型的Java</span><span class="atn">”</span><spa>pretive Java". In a nutshell, JavaScript is a dynamic scripting l
>n>。</span><span>簡言之</span><span>,</span><span>JavaScript是一種</span>anguage supporting&nbsp;<a href="/en/JavaScript/Guide/Details_of_
>><span>動態</span><span>的腳本語言</span><span>,</span><span>支持</span><s>the_Object_Model#Class-Based_vs._Prototype-Based_Languages" title
>pan>基於原型的物件結構</span><span>。</span><span>基本語法</span><span>是</span>>="en/Core_JavaScript_1.5_Guide/Details_of_the_Object_Model#Class-
><span>故意</span><span>類似</span><span>Java和</span><span>C + +來</spa>Based_vs._Prototype-Based_Languages">prototype based</a>&nbsp;obj
>n><span>減少</span><span>需要</span><span>學習語言</span><span>的</span><s>ect construction. The basic syntax is intentionally similar to bo
>pan>新</span><span>概念</span><span>。</span><span>語言結構,</span><span>>th Java and C++ to reduce the number of new concepts required to 
>如</span><span>if語句</span><span>,</span><span>for和while迴圈,和選擇</spa>learn the language. Language constructs, such as if statements, f
>n><span>,並嘗試</span><span>...</span>&nbsp;<span class="hps">catch塊>or and while loops, and switch and try ... catch blocks function 
>的功能</span><span>在這些</span><span>語言</span><span>中</span><span>的</s>the same as in these languages (or nearly so.)
>pan><span>相同</span><span>(</span><span>或接近</span><span>)</span><s 
>pan>。</span> 
n17      <span>JavaScript可以</span><span>作為</span><span>一個程序</span><sn17      JavaScript can function as both a&nbsp;<a class="external" 
>pan>和</span><span>一個物件導向</span><span>的語言</span><span>。</span><spa>href="http://en.wikipedia.org/wiki/Procedural_programming" title=
>n>創建物件</span><span>的JavaScript</span><span>編程</span><span>,</span>"http://en.wikipedia.org/wiki/Procedural_programming">procedural<
>><span>通過</span><span>附加</span><span>的方法和屬性</span><span>,否則</span>/a>&nbsp;and an&nbsp;<a class="external" href="/en/JavaScript/Int
>><span>空物件</span><span>在運行時</span><span>,而不是</span><span>編譯語言</sp>roduction_to_Object-Oriented_JavaScript" title="https://developer
>an><span>如C + +</span><span>和Java</span><span>中</span><span>常見</s>.mozilla.org/en/Introduction_to_Object-Oriented_JavaScript">objec
>pan><span>語法</span><span>類定義</span><span>。</span><span>一旦</span><>t oriented language</a>. Objects are created programmatically in 
>span>已建成</span><span>一個物件</span><span>,</span><span>它可以被</span><s>JavaScript, by attaching methods and properties to otherwise empt
>pan>用來</span><span>作為</span><span>創建</span><span>類似的物件</span><spa>y objects&nbsp;<strong>at run time</strong>, as opposed to the sy
>n>的</span><span>藍圖</span><span>。</span>>ntactic class definitions common in compiled languages like C++ a
 >nd Java. Once an object has been constructed it can be used as a 
 >blueprint (or prototype) for creating similar objects.
n20      <span>JavaScript的</span><span>動態能力包括</span><span>運行時物件的結構</n20      JavaScript's dynamic capabilities include runtime object co
>span><span>,</span><span>可變參數列表</span><span>,</span><span>函數變量</s>nstruction, variable parameter lists, function variables, dynamic
>pan><span>,</span><span>動態</span><span>腳本創建</span><span>(透過</span> script creation (via&nbsp;<code><a href="/en/JavaScript/Referenc
>><span>eval</span><span>)</span><span>,物件自我檢查</span><span>(透過</sp>e/Global_Objects/eval" title="en/Core_JavaScript_1.5_Reference/Gl
>an>&nbsp;<code>for ... in</code><span>)</span><span>,原始</span><sp>obal_Functions/eval">eval</a></code>), object introspection (via&
>an>碼</span><span>恢復(</span><span>JavaScript程序</span><span>可以將函式反編>nbsp;<code>for ... in</code>), and source code recovery (JavaScri
>譯回原始碼</span><span>)</span>>pt programs can decompile function bodies back into their source 
 >text)
n23      <span>內在</span><span>的</span><span>對象是</span><span>數字,字符串</n23      Intrinsic objects are&nbsp;<code>Number</code>,&nbsp;<code>
>span><span>,</span><span>布林</span><span>,日期</span><span>,</span>&>String</code>,&nbsp;<code>Boolean</code>,&nbsp;<code>Date</code>,
>nbsp;<font face="Courier New, Andale Mono, monospace"><span style>&nbsp;<code>RegExp</code>, and&nbsp;<code>Math</code>.
>="line-height: normal;">正規表示法</span></font><span>和數學</span><span> 
>。</span> 
n26      <span>更</span><span>深入討論</span><span>JavaScript編程</span><spn26      For a more in depth discussion of JavaScript programming fo
>an>遵循</span><span>下面</span><span>的JavaScript資源</span>>llow the&nbsp;<a href="#JavaScript_resources">JavaScript resource
 >s</a>&nbsp;links below.
27    </p>
28    <h3 name="What_JavaScript_implementations_are_available.3F">
29      What JavaScript implementations are available?
30    </h3>
31    <p>
32      mozilla.org hosts two JavaScript implementations. The first
 >&nbsp;<strong>ever</strong>&nbsp;JavaScript was created by Brenda
 >n Eich at Netscape, and has since been updated (in JavaScript 1.5
 >) to conform to ECMA-262 Edition 5. This engine, code named&nbsp;
 ><a href="/en/SpiderMonkey" title="en/SpiderMonkey">SpiderMonkey</
 >a>, is implemented in C. The&nbsp;<a href="/en/Rhino" title="en/R
 >hino">Rhino</a>&nbsp;engine, created primarily by Norris Boyd (al
 >so at Netscape) is a JavaScript implementation in Java. Like Spid
 >erMonkey, Rhino is ECMA-262 Edition 3 compliant.
n29      &nbsp;n35      Several optimizations such as TraceMonkey (Firefox 3.5), Jä
 >gerMonkey (Firefox 4) and IonMonkey were added to the SpiderMonke
 >y JavaScript engine from time to time.
30    </p>
31    <h3 name="What_JavaScript_implementations_are_available.3F">
32      <span>JavaScript的應用</span><span>有哪些?</span>
33    </h3>
34    <p>
35      <span>mozilla.org主持</span><span>兩個JavaScript應用</span>。<span
>>有史以來第一次</span>創建JavaScript是在<span>Netscape的</span><span>布倫丹·</sp 
>an><span>艾希</span>,並已被更新(在JavaScript1.5)<span>,以符合</span>ECMA-262 
>第5<span>版</span><span>。</span><span>這台發動機</span>,代號為SpiderMonkey的 
>,在C中<span>實行。</span>Rhino引擎,主要由Norris Boyd(也在網本<span>)</span><spa 
>n>創建</span><span>是</span><span>在Java中</span>的<span>JavaScript實行</ 
>span>。像SpiderMonkey一樣,Rhino是<span>ECMA</span>-262<span>第3版</span> 
><span>標準</span><span>。</span> 
n38      <span>SpiderMonkey的</span>JavaScript引擎<span>不時</span><span>n38      <br>
>被添加到</span><span>一些優化</span>,如的TraceMonkey<span>(</span><span>火狐3 
>.5</span><span>)</span><span>,</span><span>JägerMonkey</span><spa 
>n>(</span><span>火狐4</span>)<span>和</span><span>IonMonkey</span><s 
>pan>的</span><span>。</span> 
39    </p>39      Besides the above implementations, there are other popular 
 >JavaScript engines such as:-
40    <p>
41      <span>除了上述</span><span>的</span><span>實現</span><span>,也有</sp
>an><span>其他</span><span>如</span><span>流行的JavaScript</span><span>引 
>擎:</span><span>&nbsp;-&nbsp;</span> 
n44      <li>n42      <li>Google's&nbsp;<a class="external" href="http://code.goo
 >gle.com/p/v8/" title="http://code.google.com/p/v8/">V8</a>, which
 > is used in the Google Chrome browser.
45        <span>谷</span><span>歌</span><span>的</span>V8引擎,這是谷歌Chrome
>瀏覽器使用的。 
n47      <li>JavaScriptCore被用在一些WebKit瀏覽器中,<span>如</span><span>蘋果的San44      <li>The&nbsp;<a class="external" href="http://www.webkit.or
>fari</span>>g/projects/javascript/index.html" title="http://www.webkit.org/pr
 >ojects/javascript/index.html">JavaScriptCore</a>&nbsp;(SquirrelFi
 >sh/Nitro) used in some WebKit browsers such as Apple Safari.
n50        <span>carakan在Opera。</span>n47        <a class="external" href="http://my.opera.com/ODIN/blog/c
 >arakan-faq" title="http://my.opera.com/ODIN/blog/carakan-faq">Car
 >akan</a>&nbsp;in Opera.
n54      在Internet Explorer中<span>使用</span><span>的</span>Chakra引擎,在技n51      The&nbsp;<a class="external" href="http://en.wikipedia.org/
>術上是一個JScript引擎,而不是一個JavaScript引擎。>wiki/Chakra_%28JScript_engine%29" title="http://en.wikipedia.org/
 >wiki/Chakra_%28JScript_engine%29">Chakra</a>&nbsp;engine used in 
 >Internet Explorer is technically a JScript engine, rather than a 
 >JavaScript engine.
n57      <span>每個mozilla.org的JavaScript</span><span>引擎</span><span>,n54      Each mozilla.org JavaScript engine exposes a public API app
></span><span>暴露</span><span>了一個公共API</span><span>應用程序可以調用</span><>lications can call on for JavaScript support. By far, the most co
>span>的JavaScript支持</span>。<span>到目前為止,</span><span>最常見的</span><sp>mmon host environment for JavaScript is web browsers. Web browser
>an>宿主環境</span><span>為JavaScript</span>是網路瀏覽器。 網路<span class="hps">s typically use the public API to create 'host objects' responsib
>>瀏覽器</span>通常使用公共API來創建<span class="atn">“宿主對象”</span><span>負責</s>le for reflecting the&nbsp;<a class="external" href="http://www.w
>pan><span>反映</span>DOM到JavaScript。>3.org/DOM/">DOM</a>&nbsp;into JavaScript.
n60      <span>另一個</span><span>常見的應用是</span>為JavaScript(<span>Web)伺服n57      Another common application for JavaScript is as a (web) ser
>器</span>端腳本語言。<span>一個JavaScript</span><span>的Web服務器</span><span>>ver side scripting language. A JavaScript web server would expose
>會暴露</span>主機對象<span>代表</span><span>一個HTTP請求</span>和響應物件,<span>由Ja> host objects representing a HTTP request and response objects, w
>vaScript</span>動態<span>生成網頁</span><span>的</span><span>程序</span><s>hich could then be manipulated by a JavaScript program to dynamic
>pan>操作</span><span>。</span>>ally generate web pages.
n63      <span>對於</span><span>在</span><span>自己的應用程序</span>中嵌入<span>Jn60      For more information on embedding JavaScript in your own ap
>avaScript</span><span>的</span><span>詳細</span>信息,<span>下面的SpiderMo>plications, follow either the SpiderMonkey or Rhino links below, 
>nkey</span><span>或</span><span>Rhino鏈接</span><span>下面</span><span>or visit us on the netscape.public.mozilla.jseng newsgroup.
>>,</span><span>或</span>訪問我們的上<span>netscape.public.mozilla.jseng< 
>/span><span>新</span> 
n69      JavaScript資源n66      JavaScript resources
n75      <dt>n72      <dd>
76        &nbsp; &nbsp; 嵌入到JavaScript的具體信息在C引擎73        Information specific to JavaScript in C engine (aka Spide
 >rMonkey) embedding.
77      </dt>74      </dd>
n83      <dt>n80      <dd>
84        &nbsp; &nbsp; 在Java編寫的JavaScript執行的具體信息。&nbsp;(aka Rhino)81        Information specific to the JavaScript implementation wri
>.>tten in Java (aka Rhino).
85      </dt>82      </dd>
n91      <dt>n88      <dd>
92        &nbsp; &nbsp; 指針出版的JavaScript標準,LiveConnect文檔和JavaScript 89        Pointers to published JavaScript standards, LiveConnect d
>2.0的工作。>ocuments, and work on JavaScript 2.0.
93      </dt>90      </dd>
n100        <span>信息</span><span>上</span><span>的</span><span>高性能,</spn97        Information on the the high-performance, open-source virt
>an><span>開放原始碼</span><span>JavaScript 2.0的</span><span>虛擬機</span>>ual machine for JavaScript 2.0.
><span>。</span> 
n108        <span>核心JavaScript</span><span>1.5</span><span>指南</span><n105        <a href="/en/JavaScript/Guide" title="en/Core_JavaScript_
>span>和</span><span>核心JavaScript</span>1.5參考>1.5_Guide">Core JavaScript 1.5 Guide</a>&nbsp;and&nbsp;<a href="/
 >En/Core_JavaScript_1.5_Reference" title="en/Core_JavaScript_1.5_R
 >eference">Core JavaScript 1.5 Reference</a>
n116        <span>JavaScript腳本</span><span>資源</span><span>的</span><spn113        Pointers to JavaScript scripting resources, including rec
>an>指針</span><span>,</span><span>包括</span><span>推薦閱讀</span><span>,>ommended reading, online references and tutorials, and sample cod
></span><span>在線參考</span><span>和</span><span>教程</span><span>和示例代碼<>e.
>/span> 
n124        <span>使用</span><span>開源</span><span>JavaScript引擎</span><sn121        Lists other projects using the open source JavaScript eng
>pan>列出</span><span>的其他項目</span><span>。</span>>ines.
n132        <span>核心</span><span>JavaScript測試</span><span>套件</span><sn129        Information about the core JavaScript test suite.
>pan>的</span><span>信息</span><span>。</span> 
n140        <span>新聞組</span><span>討論</span><span>有關</span><span>JavaSn137        The newsgroup for discussion about the&nbsp;<strong>JavaS
>cript引擎</span>。>cript engines</strong>.
n146        <span>有關</span><span>ECMAScript的</span>,大多(雖然不一定)的一般性討論的新n143        The newsgroup for general discussion about ECMAScript, mo
>聞組,<span>因為它涉及到</span><span>瀏覽器</span><span>。</span>>stly (though not necessarily) as it pertains to browsers.
t150      <span>JavaScript是</span><span>在美國和</span><span>其他</span><spt147      JavaScript is a trademark or registered trademark of Sun Mi
>an>國家</span><span>的</span><span>Sun Microsystems公司</span><span>的商>crosystems, Inc. in the U.S. and other countries.
>標或</span><span>註冊商標</span><span>。</span> 

Back to History