javascript创建类_JavaScript的创建以及您为什么要关心

本文讲述了JavaScript如何从1995年由Brendan Eich在短短十天内创造,到成为现代网络不可或缺的一部分的历史。起初被视为轻量级、易用的语言,JavaScript逐渐成为Web开发的基石,引领了Web2.0革命。随着Node.js的推出,JavaScript突破了浏览器限制,成为服务器端编程的选择。如今,它是全球最广泛使用的编程语言之一。
摘要由CSDN通过智能技术生成

javascript创建类

It permeates everything you do.

它渗透到您所做的一切。

JavaScript is notorious for being the world’s most misunderstood programming language and it also happens to be one of the most popular ones. Virtually every personal computer in the world has JavaScript interpreters installed on it and in active use.

JavaScript以其成为世界上最容易被误解的编程语言而臭名昭著,同时它​​也恰恰是最受欢迎的编程语言之一。 实际上,世界上每台个人计算机上都安装了JavaScript解释器并正在使用中。

Image for post

Year 1995, Brendan Eich, in his mid-thirties, sat down at his desk in the Netscape headquarters, and committed himself to an enormous ten day sprint of coding. The result of which was a new language.

1995年,三十多岁的Brendan Eich在Netscape总部的办公桌旁坐下来,致力于十天的编码高峰。 结果是一种新的语言。

A new language in 10 days? Good heavens!

10天之内可以使用一种新语言? 我的妈呀!

Some programming languages shape the world of software development. JavaScript does that, of course, but also shapes the lives of everyone who uses the internet.

一些编程语言塑造了软件开发的世界。 JavaScript可以做到这一点,但是也可以影响每个使用互联网的人的生活。

Like most interesting stories, the tale of the creation of JavaScript begins in the midst of a war. Yes, I am speaking of the Great Browser Wars of the 1990’s. The nineties seem like so far away but a lot of what we enjoy today was shaped back then.

像大多数有趣的故事一样,创建JavaScript的故事始于战争之中。 是的,我说的是1990年代的“浏览器大战”。 九十年代似乎很遥远,但我们今天所享受的很多事情都是在那时形成的。

On one side we had, Netscape, and on the other side we had the Microsoft, the dominating software authority at the time.

一方面,我们拥有Netscape,另一方面,我们拥有微软,当时是主要的软件权威。

Netscape Communications Corporation, originally known as Mosaic Communications Corp., is the first company to attempt to capitalize on the emerging World Wide Web. The company’s first real product was a web browser, called Mosaic Netscape 0.9. Then came the Netscape Navigator and it looked something like this:

Netscape Communications Corporation (最初称为Mosaic Communications Corp.)是第一家尝试利用新兴的万维网的公司。 该公司的第一个实际产品是Web浏览器,称为Mosaic Netscape 0.9。 然后是Netscape Navigator 看起来像这样:

Image for post

Netscape advertised that “the web is for everyone” and stated that one of its goals was to “level the playing field” among operating systems by providing a consistent web browsing experience across them.

Netscape宣传“ 网络适​​合所有人 ”,并指出其目标之一是通过在操作系统之间提供一致的Web浏览体验来“ 平衡操作系统”。

Did you just say, “level the playing field” among operating systems? No, no, no, that does not fly well with something like Microsoft. Nope!

您只是说过在操作系统之间“公平竞争”吗? 不,不,不,这与Microsoft之类的工具配合不佳。 不!

You can imagine now what Netscape and Microsoft might have been fighting over. It was essentially a war where the winner would be the gatekeeper of the internet and live to forge a new story of how to use the internet.

您可以想象现在Netscape和Microsoft可能在争夺什么。 从本质上讲,这是一场战争,胜利者将成为互联网的看门人,并致力于打造一个有关如何使用互联网的新故事。

I mean this was 1995 where cellphones looked like this:

我的意思是在1995年,手机看起来像这样:

Image for post
Perfect for Instagram 1995 Nokia
适用于Instagram 1995 Nokia

And Jay Leno hosted the Windows 95 Launch…

Jay Leno主持了Windows 95 Launch…

Image for post

We were probably aching for something to change things up…

我们可能想找点东西来改变它……

So on one end you have Netscape who realizes that the browser was this key piece of software that people were going to use to get online. Microsoft on the other end, focused entirely on the business model that everything had to be stuffed inside Windows, and that is how people ought to do anything at all. Duh!

因此,一方面,您有Netscape,他意识到浏览器是人们用来上网的关键软件。 另一方面,Microsoft完全专注于必须将所有东西都装在Windows中的业务模型,这就是人们应该做任何事情的方式。 h!

The world was moving online and Microsoft didn’t really care about browsers at the time, until of course, they saw what Netscape was offering: a roadway to the freeway of the internet, a feeder to the highway, a stairway to…

全世界都在上网,微软当时并不真正在乎浏览器,当然,直到他们看到Netscape提供了什么:通往互联网高速公路的道路,通往高速公路的支线,通往……的楼梯……

Millions of people were using the Netscape browser to use the internet in a kind of graphical way. People began acknowledging that this Netscape browser might be the future of this thing called the internet.

数以百万计的人正在使用Netscape浏览器以一种图形方式使用Internet。 人们开始意识到这种Netscape浏览器可能是称为Internet的东西的未来。

And in that moment, as the story goes, this browser war begins. Over there in the lush Seattle headquarters, some big alarms were going off as Microsoft just watched the internet slip away. But the software behemoth had the money, people, and brand to change this. So almost a year later, in the fall of 1995, they released a browser: The Internet Explorer.

在那一刻,随着故事的发展,这场浏览器之战开始了。 在郁郁葱葱的西雅图总部那边,当微软刚刚看着互联网滑落时,一些大警报响起。 但是软件巨人拥有改变这一点的金钱,人员和品牌。 因此,差不多一年后的1995年秋天,他们发布了一个浏览器: Internet Explorer

The Internet Explorer VS Netscape Navigator — “The First Browser War”

Internet Explorer VS Netscape Navigator –“第一次浏览器大战”

Image for post

The art of warfare for both of these companies was quite different. Netscape practiced a rapid pace of development and was putting out a new browser every couple of months. It went from being a basic navigation system to having email integrated in the browser, and a couple months later, it had a search bar, and so on. It was iteratively getting better and quite rapidly people began experiencing all the different things they could do online.

这两家公司的兵法都大相径庭。 Netscape的发展速度很快,每隔几个月就要发布一个新的浏览器。 它从基本的导航系统发展到将电子邮件集成到浏览器中,几个月后,它有了搜索栏,依此类推。 逐渐变得越来越好,人们很快开始体验可以在网上进行的所有不同操作。

Microsoft, however, was accustomed to developing slowly. Here’s your four-year-long development process. It’s as bug-free as we can get it. Put it in a box, goes out to the stores, and we don’t release a new version for another four years. Enjoy it! Thanks!

但是,Microsoft习惯于缓慢发展。 这是您长达四年的开发过程。 它是我们所能获得的无错误的工具。 放进盒子里,到商店去,并且再四年都不会发布新版本。 好好享受! 谢谢!

Image for post
“I got the power”
“我有力量”

The rapid pace of development really destabilized Microsoft. But not for long. I think Microsoft realized that the browser had a huge cultural impact. It was the first thing you can do on the internet that was culturally fun. You could go on a band’s webpage and see their posts and photos. There was a real sense of connection with people across the world that you didn’t normally enjoy before the browser. This kind of graphical interface browser. The browser made the internet look like a cool magazine and this was bleeding into business, finance, banking, media, etc..

快速的发展速度确实使微软不稳定 。 但不长久。 我认为微软意识到浏览器具有巨大的文化影响。 在文化上,这是您可以在互联网上做的第一件事。 您可以在乐队的网页上查看他们的帖子和照片。 在浏览器之前,您通常不喜欢与世界各地的人们建立真正的联系。 这种图形界面的浏览器。 浏览器使互联网看起来像是一本很酷的杂志,并且正渗透到商业,金融,银行,媒体等领域。

And so in the spirit of this realization, Microsoft also realized that it was very powerful, wealthy, and influential.

因此,本着这种认识的精神,Microsoft也意识到它非常强大,富裕且有影响力。

When you ship Windows on the order of 80–90% of all computers on the planet, it’s pretty easy to make your software the default. And that is exactly what happened. The Explorer rises to the top, almost destroying the Navigator. Almost…

当您将Windows运送到全球所有计算机的80–90%时,很容易将您的软件设置为默认软件。 而这正是发生的情况。 资源管理器上升到顶部,几乎摧毁了导航器。 几乎…

This is the moment when Netscape, the underdog, threw a beautiful Hail Mary. And that turned out to change the whole world of programming.

这是失败者Netscape投掷漂亮的冰雹玛丽的时刻。 事实证明,这改变了整个编程领域。

JavaScript, or Mocha, or LiveScript, or later JScript, and later ECMAScript.

JavaScript,Mocha,LiveScript或更高版本的JScript,以及更高版本的ECMAScript。

Image for post

All this love for the internet via the browser and all the potential for life in a browser made one thing very clear. We needed a new programming language that went beyond HTML. We needed something that could drive web-based development and opened the flood gates of creativity on the internet.

通过浏览器对互联网的所有热爱以及浏览器中所有可能存在的生命使一件事变得非常清楚。 我们需要一种超越HTML的新编程语言。 我们需要能够推动基于Web的开发并打开互联网上的创意之门的东西。

At this time Java was the “cool” language, and people wondered, was Java going to be the language for web development? Developers were really wanting something light weight that could be interpreted instead of compiled, and something that would be appealing, even to the non-professional programmers.

当时,Java是“很酷”的语言,人们想知道,Java将会成为Web开发的语言吗? 开发人员确实想要的是一种重量轻,可以解释而不是编译的东西,甚至对非专业程序员也有吸引力。

Netscape understood this need for a programming language to run inside their browser. It would be something that would give life to it. They had a release date coming up for the Netscape 2.0 and they were also about to lose the browser war against Microsoft. They had ten days before the launch of the Netscape 2.0 beta, and it was now or never.

Netscape理解了在其浏览器中运行编程语言的需求。 这将赋予它生命。 他们有Netscape 2.0的发布日期,他们也将输掉与Microsoft的浏览器之战。 他们距Netscape 2.0 Beta发行还有十天的时间,现在或从未如此。

Image for post
16th Century engraving of an alchemist adding scorpion to a mixture.
16世纪雕刻家的炼金术士将蝎子添加到混合物中。

Enter… Brendan Eich. And 10 days.

输入……Brendan Eich。 还有十天。

Eich, during his time at the University of Illinois, was a well known language junkie. He used to create new languages for fun, just to play around with syntax. If there was anyone who could pull this off in 10 days, it was him.

埃希(Eich)在伊利诺伊大学期间,是一位知名的语言迷。 他过去常常为了娱乐而创建新的语言,只是在玩弄语法。 如果有谁可以在10天内实现这一目标,那就是他。

Image for post
On the 10th day…
在第十天

[Some of the language you are about to read could seem too technical, nerdy, “programmy”, but I promise, it’s okay, there is no harm in looking something up if it’s un-familiar to you. All those programming concepts are what allow you to do the things you do on the internet and beyond.]

[您将要阅读的某些语言似乎过于技术化,书呆子化,“程序化”,但是我保证,没关系,如果您不熟悉它,查找某些内容也不会有任何危害。 所有这些编程概念都使您可以做自己在互联网上以及其他地方所做的事情。]

JavaScript’s syntax is clearly inspired by the C language with its curly braces and semicolons. Some of the string patterns are taken from Java, and the object-oriented underlying patterns are taken from a programming language called Modula-2 — which is actually where the concept of first class functions comes from, and it is probably one of the most renowned features of JavaScript. There are probably more inspirations here I haven’t mentioned, but don’t mind me.

JavaScript的语法显然受C语言及其花括号和分号的启发。 某些字符串模式来自Java,而面向对象的基础模式则来自称为Modula-2的编程语言-实际上,这是一流函数概念的来源,它可能是最著名的一种JavaScript的功能。 我可能没有提到更多灵感,但请不要介意我。

So, on November 30th, 1995, JavaScript was released along with Netscape Navigator 2.0 and all the eyes were on the new magical language. America Online, AT&T, and twenty-eight other companies, agreed to use it as an open standard language. The release wasn’t without its judgments and skepticism. You had the old timers who had been programming for decades looking down at this new shiny thing. Even today actually, some people don’t consider JavaScript to be “real programming” and see it as just a language for newbies.

因此,在1995年11月30日,JavaScript与Netscape Navigator 2.0一起发布了,所有的目光都集中在新的神奇语言上。 美国在线,美国电话电报公司(AT&T)和其他28家公司同意将其用作开放标准语言。 这次发布并非没有它的判断和怀疑。 您有老程序员,他们已经编程了数十年,一直在看不起这个新事物。 实际上,即使到了今天,有些人也不认为JavaScript是“真正的编程”,而是将其视为新手的一种语言。

Image for post
Ever hear of FORTRAN kid…? Get outta here!
听说过FORTRAN小子吗? 你出去!

JavaScript sort of sneaked into our collective consciousness with the idea that it was silly, fun, easy, and lightweight. It really is a very playful language. And quirky. At the same time it is powerful and capable of doing almost anything in computer science. Perhaps I will soon write about some of these features of the language.

JavaScript有点愚蠢,有趣,易用且轻巧,从而潜入了我们的集体意识。 这确实是一种非常有趣的语言。 而且古怪。 同时,它功能强大,能够执行计算机科学中几乎所有的工作。 也许我很快会写一些关于语言的特性的文章。

Today, JavaScript is probably the world’s biggest language. It is everywhere! I mean EVERYWHERE! and you sort of have no choice but to learn it if you are entering the software arena.

今天,JavaScript可能是世界上最大的语言。 到处都是! 我的意思是到处都是! 如果您要进入软件领域,您别无选择,只能学习它。

Say you have an awesome idea and you’ve done all the logistics around it. Turns out, these days, if you want that idea to go anywhere you must have some kind of web or mobile aspect of it. So you say, “I want to build a browser application, and I want it to have all kinds of cool interactive elements so that my customers can see how awesome my idea is.” Well… you must go learn JavaScript or hire someone who knows JavaScript.

假设您有一个很棒的主意,并且已经完成了所有的准备工作。 事实证明,这些天来,如果您希望将这个想法传播到任何地方,则必须具备某种Web或移动方面的知识。 所以你说:“我想构建一个浏览器应用程序,并且希望它具有各种很酷的交互元素,以便我的客户可以看到我的想法多么棒。” 好吧……您必须去学习JavaScript或雇用认识JavaScript的人。

Even for seasoned programmers, you may ask them what their favorite language is, they have to say something like “I love Python [and JavaScript].” You just can’t escape JavaScript anymore these days. It’s here, it’s everywhere, it’s on this page, in your phone, on your browser, and it’s the one language most people are required to learn now.

即使是经验丰富的程序员,您也可能会问他们最喜欢的语言是什么,他们不得不说“我喜欢Python [和JavaScript]”。 这些天,您无法逃脱JavaScript。 它在这里,无处不在,在此页上,在您的手机中,在您的浏览器中,它是大多数人现在必须学习的一种语言。

Image for post

So we can take a moment and thank Netscape and Brendan Eich for JavaScript, and we can take a moment to thank Microsoft too for fueling the creation. But in the end, Netscape didn’t have the money, scale, and influence of Microsoft, and the Navigator disappears as a serious product.

因此,我们可以花点时间感谢Netscape和Brendan EichJavaScript,也可以花点时间感谢Microsoft推动了这一创作。 但是最后,Netscape没有微软的资金,规模和影响力,并且Navigator作为一种严肃的产品而消失了。

Microsoft’s industry-wide domination helped them despite being late to the browser game, but even they couldn’t keep up with the paradigm shift that was about to come from Netscape’s afterlife.

尽管浏览器游戏迟到了,微软在整个行业的统治仍为他们提供了帮助,但即使他们也跟不上Netscape来世的范式转变。

In early 2000s, Google Mail was released. The Gmail, as we know it. It was most likely the first application that really took JavaScript to the next level. It used it to dynamically switch content out that you were looking at in the browser. So instead of waiting for a whole new page to load, when you click on an email in your inbox, Google used JavaScript in the background to fetch the content you wanted to view, and just put it right in front of you. No more waiting for a brand new page to load.

在2000年代初期, 发布了Google Mail。 我们所知的Gmail。 它很可能是第一个真正将JavaScript提升到新水平的应用程序。 它使用它来动态切换浏览器中正在查看的内容。 因此,当您单击收件箱中的电子邮件时, Google无需等待整个页面的加载,而是在后台使用JavaScript来获取要查看的内容,并将其放在您的面前。 无需等待全新的页面加载。

This changed everything. It not only saved a ton of time and energy, but if you really think about it, the very nature of our work was completely changed. You can pretty much credit JavaScript with ushering the web 2.0 revolution. Things were not only faster, but anyone with a web browser suddenly had a development environment right in front of them.

这改变了一切。 它不仅节省了大量时间和精力,而且,如果您真的考虑一下,我们工作的本质就被彻底改变了。 通过迎接Web 2.0革命,您几乎可以相信JavaScript。 事情不仅变得更快,而且任何拥有Web浏览器的人都突然拥有开发环境。

Thus far, we’ve covered how JavaScript became the be all browser language and there was no escaping it.

到目前为止,我们已经介绍了JavaScript如何成为所有浏览器语言,并且没有逃避它。

To take things to a whole new level, in 2010 Ryan Dahl introduces Node.js. A runtime environment that executes JavaScript code outside the browser. Now developers can use JS for server-side scripting. This was actually a sort of re-assessment of Netscape’s LiveWire Pro Web, which was the first server-side JavaScript environment.

为了将事情提升到一个全新的水平, Ryan Dahl在2010年推出了Node.js。 在浏览器外部执行JavaScript代码的运行时环境。 现在,开发人员可以使用JS进行服务器端脚本编写。 这实际上是对Netscape LiveWire Pro Web的一种重新评估,它是第一个服务器端JavaScript环境。

Image for post

Today, Node.js is a huge force in the industry. One of the things that Node.js taps into that’s made it so successful is the huge community of developers to contribute to it. All you have to do is install Node.js and you are off coding away servers and rendering complex web applications.

今天,Node.js在行业中是一支巨大的力量。 Node.js如此成功的原因之一就是庞大的开发人员社区对此做出了贡献。 您所要做的就是安装Node.js,而无需编写服务器代码并呈现复杂的Web应用程序。

So first, in the browser and then on servers. JavaScript was this unpretentious, secretly elegant, sometimes buggy, language. It was a survivor of the first browser war that everybody underestimated.

因此,首先在浏览器中,然后在服务器上。 JavaScript是这种朴实无华,秘密优雅,有时甚至是错误的语言。 这是每个人都低估了第一次浏览器大战的幸存者。

Your life today is dependent on the interactivity that JavaScript provides. If you want to really see how much you depend on it, you can disable JavaScript in your browser for a day or two. Give that a try, and you will know what I am talking about. It is the driest, most boring, and dull experience.

今天的生活取决于JavaScript提供的交互性。 如果您想真正了解它的依赖性,可以在浏览器中禁用一两天JavaScript。 试试看,您会知道我在说什么。 这是最干燥,最无聊和无聊的体验。

Sure your pages will load quicker, they’ll be cleaner, you’ll have less ads, no pop-ups, and the battery life on your computer will last longer. But also parts of the webpage simply will not work. Netflix will not work. YouTube will not work. Google Docs will not work. Google Maps will not work. Ultimately, you will realize that you are, to some degree, dependent on JavaScript to function.

确保您的页面加载速度更快,页面更干净,广告更少,没有弹出窗口,并且计算机的电池寿命将更长。 但是网页的某些部分也根本无法工作。 Netflix无法正常工作。 YouTube无法正常运行。 Google文件无法使用。 Google地图不起作用。 最终,您将意识到自己在某种程度上依赖JavaScript发挥作用。

This language permeates everything we do.

这种语言渗透到我们所做的一切。

Take a moment to reflect on that, and on how the world’s DNA is changed forever.

花一点时间思考一下,以及世界DNA的永久改变。

Image for post

翻译自: https://levelup.gitconnected.com/the-creation-of-javascript-b3373824c358

javascript创建类

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值