Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1484 commits
Select commit Hold shift + click to select a range
cce0816
typo
DouglasMV Jun 11, 2019
3e2e8c7
Spelling and grammar fixes to generators and modules
jasmaa Jun 12, 2019
f6e2c89
Merge pull request #1048 from DeveloperDavo/master
iliakan Jun 12, 2019
5498450
fixes
iliakan Jun 12, 2019
60585f2
fix
iliakan Jun 12, 2019
726f08a
Merge pull request #1049 from DouglasMV/master
iliakan Jun 12, 2019
852b9bf
proxy
iliakan Jun 12, 2019
c6620f6
Fix typo
lex111 Jun 13, 2019
011eb86
css
iliakan Jun 14, 2019
afdd505
Update README.md
iliakan Jun 14, 2019
611cef3
Update README.md
iliakan Jun 14, 2019
fea7593
Update README.md
iliakan Jun 14, 2019
8be8d6c
Update README.md
iliakan Jun 14, 2019
dfb4f00
Merge branch 'master' of https://github.com/javascript-tutorial/en.ja…
jasmaa Jun 14, 2019
76d599f
rewrite global object
iliakan Jun 14, 2019
f418ab3
fix
iliakan Jun 14, 2019
ed85606
update example scripts
Violet-Bora-Lee Jun 15, 2019
661cb16
Merge pull request #1059 from Violet-Bora-Lee/patch-8
iliakan Jun 15, 2019
e35bcf2
Merge pull request #1057 from jasmaa/minor-fixes
iliakan Jun 15, 2019
358c140
fixes
iliakan Jun 15, 2019
1dc1e63
Fix typo
Violet-Bora-Lee Jun 15, 2019
0e81fb4
Fix typo (#1061)
lex111 Jun 15, 2019
42a1108
minor
iliakan Jun 15, 2019
329a53c
eval
iliakan Jun 15, 2019
70cf2b2
minor
iliakan Jun 16, 2019
0279335
fixes, eventSource
iliakan Jun 16, 2019
2638784
Fix grammer
K-Sato1995 Jun 17, 2019
d7f9017
Promise.allSettled
iliakan Jun 18, 2019
c566644
minor
iliakan Jun 18, 2019
f3bfb60
minor
iliakan Jun 18, 2019
44f687c
fixes
iliakan Jun 18, 2019
3578cb3
Merge pull request #1063 from K-Sato1995/patch-1
iliakan Jun 18, 2019
9b95b5e
minor
iliakan Jun 18, 2019
061ff30
minor
iliakan Jun 18, 2019
c8e8017
minor
iliakan Jun 18, 2019
218ef36
minor
iliakan Jun 19, 2019
a6c1662
Fix Typo
K-Sato1995 Jun 20, 2019
eeee9fe
Fix Typo (#1066)
lex111 Jun 20, 2019
7697f95
fixes
iliakan Jun 20, 2019
d9182a0
fix #1068
zombie110year Jun 20, 2019
cd84b0c
Merge pull request #1069 from zombie110year/master
iliakan Jun 20, 2019
6ebd519
Fix a Typo
K-Sato1995 Jun 21, 2019
3d009bf
Fix a Typo (#1070)
lex111 Jun 21, 2019
f6b9d22
Fix typos
K-Sato1995 Jun 21, 2019
382d4e5
specs
iliakan Jun 21, 2019
2ca9d97
Merge pull request #1072 from K-Sato1995/patch-3
iliakan Jun 21, 2019
975e496
Small typo in article
solar-artificer Jun 21, 2019
1b858a0
fixes
iliakan Jun 21, 2019
1aade86
Align the format of the sentence with the others
K-Sato1995 Jun 21, 2019
594ac2b
mixin
iliakan Jun 22, 2019
4a48dee
move misc to js/ui
iliakan Jun 22, 2019
7ccf421
Align the format of the sentence with the others (#1074)
lex111 Jun 22, 2019
9b5c1c9
minor
iliakan Jun 22, 2019
6f61b74
Fix a typo
K-Sato1995 Jun 22, 2019
5e7a370
Fix a mistake
egorzot Jun 23, 2019
5404c22
Merge branch 'master' of https://github.com/javascript-tutorial/en.ja…
alfiya-udc Jun 24, 2019
fce05f5
Merge pull request #1078 from alfiya-udc/dragndrop
iliakan Jun 24, 2019
1183727
Merge pull request #1077 from egorzot/master
iliakan Jun 24, 2019
8b07d7d
Merge pull request #1075 from K-Sato1995/patch-5
iliakan Jun 24, 2019
816bc5e
Merge pull request #1073 from solarwrath/patch-1
iliakan Jun 24, 2019
a4a1d66
Better punctuation
K-Sato1995 Jun 24, 2019
a23882d
fix
iliakan Jun 24, 2019
c14f447
fixes
iliakan Jun 24, 2019
d5f04d2
fixes
iliakan Jun 24, 2019
d2e7804
fixes
iliakan Jun 24, 2019
9d01019
minor
iliakan Jun 24, 2019
119d6e5
Fix typo
K-Sato1995 Jun 24, 2019
224231e
Fix grammer
K-Sato1995 Jun 25, 2019
9a64c1b
Fix some typos
K-Sato1995 Jun 25, 2019
2fad19d
Merge pull request #1079 from K-Sato1995/patch-5
iliakan Jun 25, 2019
4e95616
Merge pull request #1080 from K-Sato1995/patch-6
iliakan Jun 25, 2019
4b566cd
Merge pull request #1081 from K-Sato1995/patch-7
iliakan Jun 25, 2019
69fbb63
Merge pull request #1082 from K-Sato1995/patch-8
iliakan Jun 25, 2019
4f2a908
fixes
iliakan Jun 25, 2019
1e20197
Fixed sentence
DouglasMV Jun 25, 2019
fe2bfac
Fix a typo
K-Sato1995 Jun 26, 2019
1191dbb
fixes
iliakan Jun 26, 2019
52e0988
Fix Grammer
K-Sato1995 Jun 26, 2019
cb6aac9
minor
iliakan Jun 26, 2019
61910d1
minor
iliakan Jun 26, 2019
a6552eb
minor
iliakan Jun 26, 2019
79c4023
Fixed sentence
DouglasMV Jun 26, 2019
d79c761
fixes
iliakan Jun 26, 2019
25d48a3
sketch up, event loop
iliakan Jun 26, 2019
06853a9
Merge pull request #1085 from K-Sato1995/patch-9
iliakan Jun 27, 2019
5d1a8ff
Merge pull request #1087 from DouglasMV/fixes
iliakan Jun 27, 2019
e0def22
Merge pull request #1086 from K-Sato1995/patch-10
iliakan Jun 27, 2019
274bcd9
Russian line to english conversion
imanish003 Jun 27, 2019
a9622d8
Update article.md
maurodibert Jun 27, 2019
db7372c
Merge pull request #1089 from maurodibert/patch-59
iliakan Jun 27, 2019
2535664
Merge pull request #1088 from Gr8manish/patch-1
iliakan Jun 27, 2019
b5735c1
Fix English
Jun 27, 2019
b8df98e
fixes
iliakan Jun 27, 2019
a808537
Merge pull request #1091 from dyslexicon/master
iliakan Jun 27, 2019
b5bb273
Fix typo: 'propeerties' to 'properties'
Jun 28, 2019
fbac9e9
minor
iliakan Jun 28, 2019
0e8e6f3
minor
iliakan Jun 28, 2019
d1190aa
minor
iliakan Jun 28, 2019
c1f5d26
Correct spelling
Jun 28, 2019
313b233
Fix spelling and grammar
Jun 28, 2019
759ffd7
Fix grammar
Jun 28, 2019
f018012
event-loop
iliakan Jun 28, 2019
899ae4f
fixes
iliakan Jun 29, 2019
6bbe0b4
minor
iliakan Jun 29, 2019
8f72917
Chinese
aruseni Jul 1, 2019
1c73177
Strings article
aruseni Jul 1, 2019
cf641d4
Unicode
aruseni Jul 1, 2019
6c3e848
Uppercase
aruseni Jul 1, 2019
1b05095
Update solution
aruseni Jul 1, 2019
be350bb
Selection range, fixes
iliakan Jul 1, 2019
32fe559
minor
iliakan Jul 1, 2019
f1dacdc
minor
iliakan Jul 1, 2019
4bffd18
minor
iliakan Jul 1, 2019
5f0fd94
minor
iliakan Jul 1, 2019
63a8c6c
Merge pull request #1092 from fakeinc/patch-1
iliakan Jul 1, 2019
81e45f0
Merge pull request #1103 from aruseni/patch-6
iliakan Jul 1, 2019
80eaa0f
Merge pull request #1102 from aruseni/patch-5
iliakan Jul 1, 2019
d303295
Merge pull request #1101 from aruseni/patch-4
iliakan Jul 1, 2019
3c7952f
fixes ~n
iliakan Jul 1, 2019
5a8f3cc
Merge pull request #1099 from aruseni/patch-2
iliakan Jul 1, 2019
27a6d60
Merge pull request #1098 from aruseni/patch-1
iliakan Jul 1, 2019
46a9bb5
use strict for FD visibility
iliakan Jul 1, 2019
4e5533b
Merge pull request #1094 from dyslexicon/master
iliakan Jul 1, 2019
c301f7c
minor
iliakan Jul 1, 2019
2b6aec0
refs
iliakan Jul 1, 2019
ce41196
fix
iliakan Jul 1, 2019
64c648c
Fix typo
glebmikulko Jul 1, 2019
9a7deae
fix
iliakan Jul 1, 2019
a17282b
fixes
iliakan Jul 1, 2019
36bf2af
images
iliakan Jul 1, 2019
5c56e0d
minor
iliakan Jul 1, 2019
94c83e9
fixes
iliakan Jul 1, 2019
37799fb
Better punctuations
K-Sato1995 Jul 2, 2019
eb2757e
Update article.md
neoarma Jul 2, 2019
e6ad338
Update article.md
maurodibert Jul 2, 2019
df15c84
Update article.md
maurodibert Jul 2, 2019
1fece3e
Update article.md
maurodibert Jul 3, 2019
cc5213b
updates
iliakan Jul 3, 2019
fe4f5b0
minor
iliakan Jul 3, 2019
7a21366
minor
iliakan Jul 3, 2019
01acd46
Fix typo and rephrased sentence
Jul 3, 2019
b300836
minor
iliakan Jul 3, 2019
6e70837
Remove extra article
1van0v Jul 4, 2019
cf9c5ee
extra new line symbol
1van0v Jul 4, 2019
947602d
Looks like article is missed
1van0v Jul 4, 2019
b1b66a3
fixes
iliakan Jul 4, 2019
8365ea7
minor fixes
iliakan Jul 4, 2019
a42b00f
Merge pull request #1119 from 1van0v/patch-3
iliakan Jul 5, 2019
c261a8d
Merge pull request #1118 from 1van0v/patch-2
iliakan Jul 5, 2019
f887302
Merge pull request #1115 from odv/master
iliakan Jul 5, 2019
75cdd64
Merge pull request #1114 from maurodibert/patch-65
iliakan Jul 5, 2019
043d06f
Merge pull request #1112 from maurodibert/patch-64
iliakan Jul 5, 2019
bd22313
Merge pull request #1111 from maurodibert/patch-63
iliakan Jul 5, 2019
287c8e9
Merge pull request #1109 from neoarma/patch-2
iliakan Jul 5, 2019
7c3bca8
Merge pull request #1106 from K-Sato1995/patch-11
iliakan Jul 5, 2019
c631299
Merge pull request #1105 from glebmikulko/patch-1
iliakan Jul 5, 2019
c84adf8
Merge pull request #1117 from 1van0v/patch-1
iliakan Jul 5, 2019
beac683
minor
iliakan Jul 5, 2019
ad96e6c
fix links
iliakan Jul 6, 2019
0423450
fix
iliakan Jul 6, 2019
5ef182b
fixes
iliakan Jul 6, 2019
63a2d2e
fixes
iliakan Jul 6, 2019
8171ece
fixes
iliakan Jul 6, 2019
61b605b
Update article.md
ashutoshdumiyan Jul 7, 2019
5e9eca3
Merge pull request #1121 from ashutoshdumiyan/patch-1
iliakan Jul 7, 2019
4be6d6c
[strings] 2 code units are 4 bytes
aruseni Jul 7, 2019
ea84ecf
[strings] localeCompare
aruseni Jul 7, 2019
f30e0d4
minor
iliakan Jul 8, 2019
a72ced0
Remove redundant article
glebmikulko Jul 8, 2019
d1dc1a6
Remove newlines
aruseni Jul 8, 2019
17af410
Remove spaces
aruseni Jul 8, 2019
a9b2dbb
Merge pull request #1127 from glebmikulko/patch-2
iliakan Jul 8, 2019
1a29e1f
Merge pull request #1129 from aruseni/spaces
iliakan Jul 8, 2019
b56b6cc
Merge pull request #1128 from aruseni/newlines
iliakan Jul 8, 2019
2d77cc2
minor
iliakan Jul 8, 2019
52c1614
minor
iliakan Jul 9, 2019
76b6212
minor
iliakan Jul 9, 2019
31f80ee
minor
iliakan Jul 9, 2019
d1c2c4c
minor
iliakan Jul 9, 2019
89f1604
minor
iliakan Jul 9, 2019
0e3c426
minor
iliakan Jul 9, 2019
c8d3fb7
minor fix
Violet-Bora-Lee Jul 9, 2019
27890c8
Update LICENSE.md
iliakan Jul 9, 2019
18fcf02
rollback
iliakan Jul 9, 2019
4696fd0
Update LICENSE.md
iliakan Jul 9, 2019
b58f0a9
Merge pull request #1130 from Violet-Bora-Lee/patch-11
iliakan Jul 9, 2019
b3e44df
Update LICENSE.md
iliakan Jul 9, 2019
5fbe4bd
minor
iliakan Jul 9, 2019
bc92599
minor
iliakan Jul 9, 2019
3223ab3
minor
iliakan Jul 10, 2019
ac91c75
\n in strings
aruseni Jul 10, 2019
490c9b9
[strings] special characters
aruseni Jul 10, 2019
da23387
Merge pull request #1135 from aruseni/patch-9
iliakan Jul 11, 2019
9a12fcf
Merge branch 'master' into patch-7
iliakan Jul 11, 2019
1c0f029
Merge pull request #1136 from aruseni/patch-7
iliakan Jul 11, 2019
7e16f51
Merge pull request #1137 from aruseni/patch-10
iliakan Jul 11, 2019
1536666
Merge pull request #1133 from aruseni/patch-8
iliakan Jul 11, 2019
c8eb013
typo
maurodibert Jul 11, 2019
f56e924
Update article.md
maurodibert Jul 11, 2019
7add38b
change parameter name to the set one
1van0v Jul 11, 2019
a0b7d3b
typo in "by no means"
1van0v Jul 11, 2019
90e8638
Merge pull request #1138 from maurodibert/patch-66
iliakan Jul 11, 2019
ce42dab
Merge pull request #1143 from 1van0v/patch-5
iliakan Jul 11, 2019
e4b7f66
Merge pull request #1140 from 1van0v/patch-4
iliakan Jul 11, 2019
6745897
Merge pull request #1139 from maurodibert/patch-67
iliakan Jul 11, 2019
5331f59
Update article.md
tonchique Jul 12, 2019
be342e5
Merge pull request #1147 from tonchique/patch-8
iliakan Jul 13, 2019
462dfb3
Add stylistic and grammar fixes
Doesntmeananything Jul 15, 2019
9ff7e2d
fix typo
1van0v Jul 15, 2019
7cf0e03
Moved position of ')' in a code block to permit proper assignment sta…
caproven Jul 15, 2019
4a5b5ad
minor fix
Violet-Bora-Lee Jul 16, 2019
e5321b4
Merge pull request #1150 from Doesntmeananything/patch-1
iliakan Jul 16, 2019
08533d4
Merge pull request #1154 from Violet-Bora-Lee/patch-12
iliakan Jul 16, 2019
b63dda6
Merge pull request #1152 from caproven/patch-1
iliakan Jul 16, 2019
11e9d98
Merge pull request #1151 from 1van0v/patch-6
iliakan Jul 16, 2019
0a7ded5
[strings] Surrogate pairs S example
aruseni Jul 16, 2019
9ff9aae
Merge pull request #1155 from aruseni/patch-11
iliakan Jul 16, 2019
77656ff
Update article.md
tonchique Jul 16, 2019
67e317c
Update LICENSE.md
iliakan Jul 16, 2019
1c41c42
Update article.md
tonchique Jul 16, 2019
52ef325
improvements
iliakan Jul 16, 2019
edf1a45
Fix the numbers in an ordered list, from 1. 3. to 1. 2., and moved th…
luc4leone Jul 17, 2019
49381c3
Merge pull request #1158 from luc4leone/fix-ordered-list
iliakan Jul 17, 2019
ad6f0cd
coords
iliakan Jul 17, 2019
57b5696
minor
iliakan Jul 18, 2019
f91b22a
updates
iliakan Jul 18, 2019
64197a0
minor
iliakan Jul 18, 2019
0b55d45
Update article.md
iliakan Jul 18, 2019
3caa911
fixes
iliakan Jul 18, 2019
c7df8e3
Update article.md
mootookoi Jul 18, 2019
a7a267b
Merge pull request #1162 from mootookoi/patch-1
iliakan Jul 18, 2019
227a0f2
Merge pull request #1157 from tonchique/patch-10
iliakan Jul 18, 2019
cf6e172
Merge pull request #1156 from tonchique/patch-9
iliakan Jul 18, 2019
65128b2
'property values' instead of 'field' in code comment
luc4leone Jul 18, 2019
369b0ba
Merge pull request #1163 from luc4leone/field
iliakan Jul 18, 2019
2695e4f
Update article.md
Violet-Bora-Lee Jul 18, 2019
807414b
Merge pull request #1164 from Violet-Bora-Lee/patch-13
iliakan Jul 18, 2019
94a6933
fixes
iliakan Jul 18, 2019
34b51dc
minor
iliakan Jul 18, 2019
6c7c7d3
Added a dot notation example
luc4leone Jul 19, 2019
b64d7af
Change double quotes for backtick to fix rendering
luc4leone Jul 19, 2019
469bbb3
Merge pull request #1168 from luc4leone/proto
iliakan Jul 19, 2019
b11005c
split map-set apart from weakmap-weakset
iliakan Jul 19, 2019
76b6eaf
fixes
iliakan Jul 19, 2019
746fe5f
minor
iliakan Jul 19, 2019
5d549f5
minor
iliakan Jul 19, 2019
2b18776
minor
iliakan Jul 20, 2019
7c340a1
minor
iliakan Jul 20, 2019
4a8d898
minor
iliakan Jul 21, 2019
db69048
merging all conflicts
iliakan Jul 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
93 changes: 93 additions & 0 deletions 1-js/01-getting-started/1-intro/article.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# JavaScript 简介

<<<<<<< HEAD
我们一起来聊一下 JavaScript,用它能做什么,它有哪些特性,以及一些跟它配合使用的技术。
=======
Let's see what's so special about JavaScript, what we can achieve with it, and which other technologies play well with it.
>>>>>>> 4a8d8987dfc3256045e6b4a3bd8810ad3b25d1b3

## 什么是 JavaScript?

<<<<<<< HEAD
**JavaScript** 最初的目的是为了“**赋予网页生命**”。

这种编程语言我们称之为**脚本**。它们可以写在 HTML 中,在页面加载的时候会自动执行。
Expand Down Expand Up @@ -31,23 +36,64 @@ JavaScript 在刚诞生的时候,它的名字叫 “LiveScript”。但是因
上面这些名称很容易记忆,因为经常出现在网上开发者的文章中。我们也会用到这些名称。例如:某个新的功能,如果 JavaScript 引擎 V8 是支持的,那么我们可以认为这个功能大概能在 Chrome 和 Opera 中正常运行。

```smart header="引擎是如何工作的?"
=======
*JavaScript* was initially created to *"make web pages alive"*.

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.

Scripts are provided and executed as plain text. They don't need special preparation or compilation to run.

In this aspect, JavaScript is very different from another language called [Java](https://en.wikipedia.org/wiki/Java_(programming_language)).

```smart header="Why <u>Java</u>Script?"
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.

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.
```

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).

The browser has an embedded engine sometimes called a "JavaScript virtual machine".

Different engines have different "codenames". For example:

- [V8](https://en.wikipedia.org/wiki/V8_(JavaScript_engine)) -- in Chrome and Opera.
- [SpiderMonkey](https://en.wikipedia.org/wiki/SpiderMonkey) -- in Firefox.
- ...There are other codenames like "Trident" and "Chakra" for different versions of IE, "ChakraCore" for Microsoft Edge, "Nitro" and "SquirrelFish" for Safari, etc.

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.

```smart header="How do engines work?"
>>>>>>> 4a8d8987dfc3256045e6b4a3bd8810ad3b25d1b3

引擎很复杂,但是基本原理很简单。

1. 引擎(通常嵌入在浏览器中)读取(“解析”)脚本。
2. 然后将脚本转化(“编译”)为机器语言。
3. 然后这机器语言代码快速地运行。

<<<<<<< HEAD
引擎会对流程中的每个阶段都进行优化。它甚至可以在运行时监视编译的脚本,分析数据流并根据这些对机器代码应用优化。最后,脚本会执行地非常快。
=======
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.
>>>>>>> 4a8d8987dfc3256045e6b4a3bd8810ad3b25d1b3
```

## 浏览器中的 JavaScript 能做什么 ?

<<<<<<< HEAD
现代的 JavaScript 是一种“安全”语言。它不提供对内存或 CPU 的底层访问,因为它最初是为浏览器创建的,不需要这些功能。

JavaScript 的能力依赖于它执行的环境。例如:[Node.js](https://wikipedia.org/wiki/Node.js) 允许 JavaScript 读写任意文件、执行网络请求等。

浏览器中的 JavaScript 可以做与网页操作、用户交互和 Web 服务器相关的所有事情。
=======
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.

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.

In-browser JavaScript can do everything related to webpage manipulation, interaction with the user, and the webserver.
>>>>>>> 4a8d8987dfc3256045e6b4a3bd8810ad3b25d1b3

例如,浏览器中的 JavaScript 可以完成下面这些事:

Expand All @@ -61,7 +107,11 @@ JavaScript 的能力依赖于它执行的环境。例如:[Node.js](https://wik

为了用户的(信息)安全,在浏览器中的 JavaScript 的能力是有限的。这样主要是为了阻止邪恶的网站获得或修改用户的私人数据。

<<<<<<< HEAD
这些限制的例子有:
=======
Examples of such restrictions include:
>>>>>>> 4a8d8987dfc3256045e6b4a3bd8810ad3b25d1b3

- 网页中的 JavaScript 不能读、写、复制及执行用户磁盘上的文件或程序。它没有直接访问操作系统的功能。

Expand All @@ -70,6 +120,7 @@ JavaScript 的能力依赖于它执行的环境。例如:[Node.js](https://wik
JavaScript 有很多方式和照相机/麦克风或者其他设备进行交互,但是这些都需要提前获得用户的授权许可。所以,启用了 JavaScript 的网页可能不会偷偷地启动网络摄像头观察你,并把你的信息发送到[美国国家安全局](https://en.wikipedia.org/wiki/National_Security_Agency)。
- 不同的浏览器标签页之间基本彼此不相关。有时候,也会有一些关系。例如,通过 JavaScript 打开另外一个新的标签页。但即使在这种情况下,如果两个标签页打开的不是同一个网站(域名、协议或者端口任一不相同的网站),他们都不能够相互通信。

<<<<<<< HEAD
这就是“同源策略”。为了解决不同标签页交互的问题,两个同源的网站必须**都**包含一些特殊的 JavaScript 代码,才能够实现数据交换。

这个限制也是为了用户的信息安全。例如,用户打开的 `http://anysite.com` 网页的 JavaScript 不能访问 `http://gmail.com`(另外一个标签页打开的网页)也不能从那里窃取信息。
Expand All @@ -78,22 +129,45 @@ JavaScript 的能力依赖于它执行的环境。例如:[Node.js](https://wik
![](limitations.png)

浏览器环境外的 JavaScript 一般没有这些限制。例如服务端的 JavaScript 就没有这些限制。现代浏览器还允许通过 JavaScript 来安装浏览器插件或扩展,当然这也是在用户授权的前提下。
=======
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.

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.
- 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.

![](limitations.png)

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.
>>>>>>> 4a8d8987dfc3256045e6b4a3bd8810ad3b25d1b3

## JavaScript 为什么与众不同?

至少有 **3** 件事值得一提:

```compare
<<<<<<< HEAD
+ 和 HTML/CSS 完全的集成。
+ 使用简单的工具完成简单的任务。
+ 被所有的主流浏览器支持,并且默认开启。
=======
+ Full integration with HTML/CSS.
+ Simple things are done simply.
+ Support by all major browsers and enabled by default.
>>>>>>> 4a8d8987dfc3256045e6b4a3bd8810ad3b25d1b3
```
JavaScript is the only browser technology that combines these three things.

<<<<<<< HEAD
满足这三条的浏览器技术也只有 JavaScript 了。

这就是为什么 JavaScript 与众不同!这也是为什么它是创建浏览器界面的最普遍的工具。

当然,学习一项新技术的时候,最好先看一下它的前景。所以,接下来我们继续讨论包括新语言和浏览器功能在内的现代趋势。
=======
That's what makes JavaScript unique. That's why it's the most widespread tool for creating browser interfaces.

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.
>>>>>>> 4a8d8987dfc3256045e6b4a3bd8810ad3b25d1b3


## 比 JavaScript “好” 的语言
Expand All @@ -104,19 +178,38 @@ JavaScript 的能力依赖于它执行的环境。例如:[Node.js](https://wik

所以,最近出现了很多不同的语言,这些语言在浏览器中执行之前,都会被**编译**(转化)成 JavaScript。

<<<<<<< HEAD
现代化的工具使得编译速度非常快速和透明,实际上允许开发人员使用另一种语言编写代码并将其自动转换为 JavaScript。
=======
Modern tools make the transpilation very fast and transparent, actually allowing developers to code in another language and auto-converting it "under the hood".
>>>>>>> 4a8d8987dfc3256045e6b4a3bd8810ad3b25d1b3

这些语言的例子有:

<<<<<<< HEAD
- [CoffeeScript](http://coffeescript.org/) 是 JavaScript 的语法糖,它语法简短,明确简洁。通常使用 Ruby 的人喜欢用。
- [TypeScript](http://www.typescriptlang.org/) 将注意力集中在增加严格的数据类型。这样就能简化开发,也能用于开发复杂的系统。TypeScript 是微软开发的。
- [Flow](http://flow.org/) 也添加了数据类型,但是以一种不同的方式。由 Facebook 开发。
- [Dart](https://www.dartlang.org/) 是一门独立的语言。它拥有自己的引擎用于在非浏览器环境中运行(如:在手机应用中运行),它也能被编译成 JavaScript 。由 Google 开发。

还有更多其他的语言。当然,即使我们在使用这些语言,我们也需要知道 JavaScript。因为学习 JavaScript 可以让我们真正明白我们自己在做什么。
=======
- [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.
- [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.
- [Flow](http://flow.org/) also adds data typing, but in a different way. Developed by Facebook.
- [Dart](https://www.dartlang.org/) is a standalone language that has its own engine that runs in non-browser environments (like mobile apps), but also can be transpiled to JavaScript. Developed by Google.

There are more. Of course, even if we use one of transpiled languages, we should also know JavaScript to really understand what we're doing.
>>>>>>> 4a8d8987dfc3256045e6b4a3bd8810ad3b25d1b3

## 总结

<<<<<<< HEAD
- JavaScript 最开始是为浏览器设计的一门语言,但是现在也可以在其它的环境中运行。
- 现在,JavaScript 是一门在浏览器中使用最广、并且能够很好集成 HTML/CSS 的语言。
- 有很多其他的语言可以编译成 JavaScript,这些语言还提供更多的功能。最好要了解一下这些语言,至少需要在掌握 JavaScript 之后简单地看一下。
=======
- JavaScript was initially created as a browser-only language, but is now used in many other environments as well.
- Today, JavaScript has a unique position as the most widely-adopted browser language with full integration with HTML/CSS.
- 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.
>>>>>>> 4a8d8987dfc3256045e6b4a3bd8810ad3b25d1b3
Binary file modified 1-js/01-getting-started/1-intro/limitations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified 1-js/01-getting-started/1-intro/limitations@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions 1-js/01-getting-started/2-manuals-specifications/article.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

<<<<<<< HEAD
# 手册与规范

这本书是一本*教程*。它(撰写的)目的是帮助你逐渐掌握这门语言。但是一旦你已经熟悉了这门语言的基础,你就会需要其他资料。
Expand Down Expand Up @@ -39,3 +40,46 @@ JavaScript 还是一门正在发展的语言,新的功能经常被添加。
所有这些资源在实际开发中都有用武之地,因为他们包含了语言细节以及它们被支持的程度等有价值的信息。

为了不要让你在真正需要深入了解特定功能的时候捉襟见肘,请记住它们(或者这一页)。
=======
# Manuals and specifications

This book is a *tutorial*. It aims to help you gradually learn the language. But once you're familiar with the basics, you'll need other sources.

## Specification

**The ECMA-262 specification** contains the most in-depth, detailed and formalized information about JavaScript. It defines the language.

But being that formalized, it's difficult to understand at first. So if you need the most trustworthy source of information about the language details, the specification is the right place. But it's not for everyday use.

The latest draft is at <https://tc39.es/ecma262/>.

To read about new bleeding-edge features, including those that are "almost standard" (so-called "stage 3"), see proposals at <https://github.com/tc39/proposals>.

Also, if you're in developing for the browser, then there are other specs covered in the [second part](info:browser-environment) of the tutorial.

## Manuals

- **MDN (Mozilla) JavaScript Reference** is a manual with examples and other information. It's great to get in-depth information about individual language functions, methods etc.

One can find it at <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference>.

Although, it's often best to use an internet search instead. Just use "MDN [term]" in the query, e.g. <https://google.com/search?q=MDN+parseInt> to search for `parseInt` function.


- **MSDN** – Microsoft manual with a lot of information, including JavaScript (often referrerd to as JScript). If one needs something specific to Internet Explorer, better go there: <http://msdn.microsoft.com/>.

Also, we can use an internet search with phrases such as "RegExp MSDN" or "RegExp MSDN jscript".

## Compatibility tables

JavaScript is a developing language, new features get added regularly.

To see their support among browser-based and other engines, see:

- <http://caniuse.com> - per-feature tables of support, e.g. to see which engines support modern cryptography functions: <http://caniuse.com/#feat=cryptography>.
- <https://kangax.github.io/compat-table> - a table with language features and engines that support those or don't support.

All these resources are useful in real-life development, as they contain valuable information about language details, their support etc.

Please remember them (or this page) for the cases when you need in-depth information about a particular feature.
>>>>>>> 4a8d8987dfc3256045e6b4a3bd8810ad3b25d1b3
48 changes: 48 additions & 0 deletions 1-js/01-getting-started/3-code-editors/article.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< HEAD
# 编辑器

程序员接触时间最长的就是代码编辑器(后面简称编辑器)。
Expand Down Expand Up @@ -43,3 +44,50 @@ IDE 加载项目(通常包含多个文件),并且允许在不同文件之
世上还有很多其他的很好的编辑器,你们可以选择一个自己最喜欢的。

选择编辑器就像选择其他工具一样。要看你的项目,以及个人的习惯、喜好。
=======
# Code editors

A code editor is the place where programmers spend most of their time.

There are two main types of code editors: IDEs and lightweight editors. Many people use one tool of each type.

## IDE

The term [IDE](https://en.wikipedia.org/wiki/Integrated_development_environment) (Integrated Development Environment) refers to a powerful editor with many features that usually operates on a "whole project." As the name suggests, it's not just an editor, but a full-scale "development environment."

An IDE loads the project (which can be many files), allows navigation between files, provides autocompletion based on the whole project (not just the open file), and integrates with a version management system (like [git](https://git-scm.com/)), a testing environment, and other "project-level" stuff.

If you haven't selected an IDE yet, consider the following options:

- [Visual Studio Code](https://code.visualstudio.com/) (cross-platform, free).
- [WebStorm](http://www.jetbrains.com/webstorm/) (cross-platform, paid).

For Windows, there's also "Visual Studio", not to be confused with "Visual Studio Code". "Visual Studio" is a paid and mighty Windows-only editor, well-suited for the .NET platform. It's also good at JavaScript. There's also a free version [Visual Studio Community](https://www.visualstudio.com/vs/community/).

Many IDEs are paid, but have a trial period. Their cost is usually negligible compared to a qualified developer's salary, so just choose the best one for you.

## Lightweight editors

"Lightweight editors" are not as powerful as IDEs, but they're fast, elegant and simple.

They are mainly used to open and edit a file instantly.

The main difference between a "lightweight editor" and an "IDE" is that an IDE works on a project-level, so it loads much more data on start, analyzes the project structure if needed and so on. A lightweight editor is much faster if we need only one file.

In practice, lightweight editors may have a lot of plugins including directory-level syntax analyzers and autocompleters, so there's no strict border between a lightweight editor and an IDE.

The following options deserve your attention:

- [Atom](https://atom.io/) (cross-platform, free).
- [Sublime Text](http://www.sublimetext.com) (cross-platform, shareware).
- [Notepad++](https://notepad-plus-plus.org/) (Windows, free).
- [Vim](http://www.vim.org/) and [Emacs](https://www.gnu.org/software/emacs/) are also cool if you know how to use them.

## Let's not argue

The editors in the lists above are those that either I or my friends whom I consider good developers have been using for a long time and are happy with.

There are other great editors in our big world. Please choose the one you like the most.

The choice of an editor, like any other tool, is individual and depends on your projects, habits, and personal preferences.
>>>>>>> 4a8d8987dfc3256045e6b4a3bd8810ad3b25d1b3
Loading