「譯」 「PJA」 「100」 第一章 JavaScript 革命

In case you haven’t heard, JavaScript is arguably the most important programming language on Earth. Once thought of as a toy, JavaScript is now the most widely deployed programming language in history. Almost everyone with a computer or a smart phone has all the tools they need to execute JavaScript programs, and create their own. All you need is a browser and a text editor.

你可能還不知道,JavaScript 可以說是地球上最重要的程序語言。雖然曾經被看作“玩具語言”,但 JavaScript 目前已經成為史上應用最廣的程序語言。擁有一臺電腦或智能手機,就相當於擁有了執行(甚至創建)JavaScript 程序的必備工具。你所需要的一切,就是一款網頁瀏覽器,加上文本編輯器。

JavaScript, HTML and CSS have become so prevalent that many operating systems have adopted the open web standards as the presentation layer for native apps. Even Microsoft announced that the Windows 8 UI will be driven by open web standards.

JavaScript、HTML 和 CSS 已經變得如此流行,以至於許多操作系統已經採用了這些開放的 Web 標準作為原生應用的表現層。甚至微軟公司也聲稱 Windows 8 的 UI 層將由這些開放的 Web 標準技術來驅動。

Creating a JavaScript program is as simple as editing a text file and opening it in the browser. No complex development environments to download and install. No complex IDE to learn. JavaScript is easy to learn, too. The basic syntax is immediately familiar to any programmer who has been exposed to the C family syntax. No other language can boast a barrier to entry as low as JavaScript.

創建一個 JavaScript 程序十分簡單,編輯一個文本文件並在瀏覽器中打開它就行了。並不需要下載安裝複雜的開發環境;不需要學習複雜的 IDE 工具;JavaScript 語言本身也十分易學。對於任何一個接觸過類 C 語法的程序員來說,JavaScript 的基本語法可以立即上手。沒有其它語言可以像 JavaScript 這樣擁有如此之低的學習門檻。

That low barrier to entry is probably the main reason that JavaScript was once widely (perhaps rightly) shunned as a toy. It was mainly used to create UI effects in the browser. That situation has changed.

“低門檻”可能就是當年 JavaScript 被普遍地貶低為一門玩具語言的主要原因(或許人們並沒說錯)。那時它主要用於在瀏覽器中創建 UI 特效。但是,時局已變。

For a long time, there was no way to save data with JavaScript. If you wanted data to persist, you had to submit a form to a web server and wait for a page refresh. That hindered the process of creating responsive and dynamic web applications. However, in 2000, Microsoft started shipping Ajax technology in Internet Explorer. Soon after, other browsers added support for the XMLHttpRequest object.

在相當長的時間內,JavaScript 無法保存數據。如果你想把數據持久保存,就只能通過表單把數據提交到一臺 Web 服務器,並等待頁面刷新。這阻礙了創建快速響應的、動態的 Web 應用的步伐。然而在 2000 年,微軟開始在 IE 瀏覽器中搭載 Ajax 技術。此後不久,其它瀏覽器也紛紛增加了對 XMLHttpRequest 對象的支持。

In 2004, Google launched Gmail. Initially applauded because it promised users nearly infinite storage for their email, Gmail also brought a major revolution. Gone were the page refreshes. Under the hood, Gmail was taking advantage of the new Ajax technology, creating a single page, fast, responsive web application that would forever change the way that web applications are designed.

2004 年,Google 發佈 Gmail。這項服務首先通過近乎無限的存儲空間贏得了用戶的喝彩,同時它也引發了一場重大變革。“頁面刷新”一去不復返了。在程序內部,Gmail 得益於全新的 Ajax 技術,打造了一款單頁的、快速響應的 Web 應用程序,它永久改變了 Web 應用程序的設計方式。

Since that time, web developers have produced nearly every type of application, including full blown cloud-based office suites (see Zoho.com), social APIs like Facebook’s JavaScript SDK, even graphically intensive video games.

從那時開始,Web 開發者們實現了各種類型的應用程序,這其中包括完全成熟的基於雲端的辦公套件(參見 Zoho.com)、以 Facebook 的 JavaScript SDK 為代表的社會化 API、甚至是圖形密集的電子遊戲等等。

JavaScript didn’t just luck into its position as the dominant client side language on the web. It is actually very well suited to be the language that took over the world. It is one of the most advanced and expressive programming languages developed to date. Here are some of the features you may or may not be familiar with:

JavaScript 並沒有固步於 Web 客戶端的壟斷地位,它實際上也十分適合成為那種掌管一切的語言。它是人類迄今為止創造出的最先進、最具表現力的程序語言之一。以下是一些你可能熟悉(或不熟悉)的關於它的特徵。

希望本文能幫助到您!

點贊+轉發,讓更多的人也能看到這篇內容(收藏不點贊,都是耍流氓-_-)

關注 {我},享受文章首發體驗!

每週重點攻克一個前端技術難點。更多精彩前端內容私信 我 回覆“教程”

原文鏈接:https://github.com/cssmagic/blog/issues/18


分享到:


相關文章: