You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
これらの用語は、インターネット上の開発者の記事で使用されているため、覚えておくと良いでしょう。 たとえば、"ある機能 X がV8でサポートされている" と言った場合、おそらくChromeとOperaで動作します。
32
37
33
38
```smart header="エンジンはどのように動く?"
39
+
=======
40
+
*JavaScript* was initially created to *"make web pages alive"*.
41
+
42
+
The programs in this language are called *scripts*. They can be written right in a web page's HTML and run automatically as the page loads.
43
+
44
+
Scripts are provided and executed as plain text. They don't need special preparation or compilation to run.
45
+
46
+
In this aspect, JavaScript is very different from another language called [Java](https://en.wikipedia.org/wiki/Java_(programming_language)).
47
+
48
+
```smart header="Why <u>Java</u>Script?"
49
+
When JavaScript was created, it initially had another name: "LiveScript". But Java was very popular at that time, so it was decided that positioning a new language as a "younger brother" of Java would help.
50
+
51
+
But as it evolved, JavaScript became a fully independent language with its own specification called [ECMAScript](http://en.wikipedia.org/wiki/ECMAScript), and now it has no relation to Java at all.
52
+
```
53
+
54
+
Today, JavaScript can execute not only in the browser, but also on the server, or actually on any device that has a special program called [the JavaScript engine](https://en.wikipedia.org/wiki/JavaScript_engine).
55
+
56
+
The browser has an embedded engine sometimes called a "JavaScript virtual machine".
57
+
58
+
Different engines have different "codenames". For example:
59
+
60
+
-[V8](https://en.wikipedia.org/wiki/V8_(JavaScript_engine)) -- in Chrome and Opera.
61
+
-[SpiderMonkey](https://en.wikipedia.org/wiki/SpiderMonkey) -- in Firefox.
62
+
- ...There are other codenames like "Trident" and "Chakra" for different versions of IE, "ChakraCore" for Microsoft Edge, "Nitro" and "SquirrelFish" for Safari, etc.
63
+
64
+
The terms above are good to remember because they are used in developer articles on the internet. We'll use them too. For instance, if "a feature X is supported by V8", then it probably works in Chrome and Opera.
The engine applies optimizations at each step of the process. It even watches the compiled script as it runs, analyzes the data that flows through it, and applies optimizations to the machine code based on that knowledge. When it's done, scripts run quite fast.
Modern JavaScript is a "safe" programming language. It does not provide low-level access to memory or CPU, because it was initially created for browsers which do not require it.
92
+
93
+
JavaScript's capabilities greatly depend on the environment it's running in. For instance, [Node.js](https://wikipedia.org/wiki/Node.js) supports functions that allow JavaScript to read/write arbitrary files, perform network requests, etc.
94
+
95
+
In-browser JavaScript can do everything related to webpage manipulation, interaction with the user, and the webserver.
This is called the "Same Origin Policy". To work around that, *both pages* must agree for data exchange and contain a special JavaScript code that handles it. We'll cover that in the tutorial.
136
+
137
+
This limitation is, again, for the user's safety. A page from `http://anysite.com` which a user has opened must not be able to access another browser tab with the URL `http://gmail.com` and steal information from there.
138
+
- JavaScript can easily communicate over the net to the server where the current page came from. But its ability to receive data from other sites/domains is crippled. Though possible, it requires explicit agreement (expressed in HTTP headers) from the remote side. Once again, that's a safety limitation.
139
+
140
+

141
+
142
+
Such limits do not exist if JavaScript is used outside of the browser, for example on a server. Modern browsers also allow plugin/extensions which may ask for extended permissions.
143
+
>>>>>>> 9cb33f4039e5751bfd0e2bca565a37aa463fb477
83
144
84
145
## なにがJavaScriptを特別なものにしている?
85
146
86
147
JavaScriptには少なくとも *3つ* の素晴らしいことがあります:
87
148
88
149
```compare
150
+
<<<<<<< HEAD
89
151
+ HTML/CSSとの完全な統合
90
152
+ シンプルなことはシンプルに
91
153
+ すべてのメジャーブラウザでサポートされており、デフォルトで有効
154
+
=======
155
+
+ Full integration with HTML/CSS.
156
+
+ Simple things are done simply.
157
+
+ Support by all major browsers and enabled by default.
158
+
>>>>>>> 9cb33f4039e5751bfd0e2bca565a37aa463fb477
92
159
```
160
+
JavaScript is the only browser technology that combines these three things.
That's what makes JavaScript unique. That's why it's the most widespread tool for creating browser interfaces.
169
+
170
+
While planning to learn a new technology, it's beneficial to check its perspectives. So let's move on to the modern trends affecting it, including new languages and browser abilities.
Modern tools make the transpilation very fast and transparent, actually allowing developers to code in another language and auto-converting it "under the hood".
-[CoffeeScript](http://coffeescript.org/) is a "syntactic sugar" for JavaScript. It introduces shorter syntax, allowing us to write clearer and more precise code. Usually, Ruby devs like it.
198
+
-[TypeScript](http://www.typescriptlang.org/) is concentrated on adding "strict data typing" to simplify the development and support of complex systems. It is developed by Microsoft.
199
+
-[Dart](https://www.dartlang.org/) is a standalone language that has its own engine that runs in non-browser environments (like mobile apps). It was initially offered by Google as a replacement for JavaScript, but as of now, browsers require it to be transpiled to JavaScript just like the ones above.
200
+
201
+
There are more. Of course, even if we use one of these languages, we should also know JavaScript to really understand what we're doing.
- JavaScript was initially created as a browser-only language, but is now used in many other environments as well.
212
+
- Today, JavaScript has a unique position as the most widely-adopted browser language with full integration with HTML/CSS.
213
+
- There are many languages that get "transpiled" to JavaScript and provide certain features. It is recommended to take a look at them, at least briefly, after mastering JavaScript.
0 commit comments