Skip to content

Commit 51bc6d3

Browse files
author
root
committed
merging all conflicts
2 parents 68ce16d + a0266c5 commit 51bc6d3

File tree

1,212 files changed

+36226
-5084
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,212 files changed

+36226
-5084
lines changed

1-js/01-getting-started/1-intro/article.md

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,33 @@
66

77
*जावास्क्रिप्ट* को पहली बार *वेब पेजेस चलाने* के लिए बनाया गया था
88

9+
<<<<<<< HEAD
910
इस भाषा में प्रोग्राम को *स्क्रिप्ट्स* कहा जाता है They can be written right in the HTML and executed automatically as the page loads.
11+
=======
12+
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.
13+
>>>>>>> a0266c574c0ab8a0834dd38ed65e7e4ee27f9cdb
1014
11-
Scripts are provided and executed as a plain text. They don't need a special preparation or a compilation to run.
15+
Scripts are provided and executed as plain text. They don't need special preparation or compilation to run.
1216

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

1519
```smart header="Why <u>Java</u>Script?"
16-
When JavaScript was created, it initially had another name: "LiveScript". But Java language was very popular at that time, so it was decided that positioning a new language as a "younger brother" of Java would help.
20+
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.
1721
18-
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.
22+
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.
1923
```
2024

21-
At present, JavaScript can not only execute 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).
25+
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).
2226

23-
The browser has an embedded engine, sometimes called a "JavaScript virtual machine".
27+
The browser has an embedded engine sometimes called a "JavaScript virtual machine".
2428

25-
Different engines have different "codenames", for example:
29+
Different engines have different "codenames". For example:
2630

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

31-
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.
35+
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.
3236

3337
```smart header="How do engines work?"
3438
@@ -38,14 +42,14 @@ Engines are complicated. But the basics are easy.
3842
2. Then it converts ("compiles") the script to the machine language.
3943
3. And then the machine code runs, pretty fast.
4044
41-
The engine applies optimizations on every stage 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. At the end, scripts are quite fast.
45+
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.
4246
```
4347

4448
## What can in-browser JavaScript do?
4549

46-
The 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.
50+
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.
4751

48-
The capabilities greatly depend on the environment that runs JavaScript. For instance, [Node.JS](https://wikipedia.org/wiki/Node.js) supports functions that allow JavaScript to read/write arbitrary files, perform network requests, etc.
52+
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.
4953

5054
In-browser JavaScript can do everything related to webpage manipulation, interaction with the user, and the webserver.
5155

@@ -61,7 +65,7 @@ For instance, in-browser JavaScript is able to:
6165

6266
JavaScript's abilities in the browser are limited for the sake of the user's safety. The aim is to prevent an evil webpage from accessing private information or harming the user's data.
6367

64-
The examples of such restrictions are:
68+
Examples of such restrictions include:
6569

6670
- JavaScript on a webpage may not read/write arbitrary files on the hard disk, copy them or execute programs. It has no direct access to OS system functions.
6771

@@ -70,14 +74,14 @@ The examples of such restrictions are:
7074
There are ways to interact with camera/microphone and other devices, but they require a user's explicit permission. So a JavaScript-enabled page may not sneakily enable a web-camera, observe the surroundings and send the information to the [NSA](https://en.wikipedia.org/wiki/National_Security_Agency).
7175
- Different tabs/windows generally do not know about each other. Sometimes they do, for example when one window uses JavaScript to open the other one. But even in this case, JavaScript from one page may not access the other if they come from different sites (from a different domain, protocol or port).
7276

73-
This is called the "Same Origin Policy". To work around that, *both pages* must contain a special JavaScript code that handles data exchange.
77+
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.
7478

75-
The limitation is again for 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.
76-
- 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 safety limitations.
79+
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.
80+
- 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.
7781

7882
![](limitations.png)
7983

80-
Such limits do not exist if JavaScript is used outside of the browser, for example on a server. Modern browsers also allow installing plugin/extensions which may get extended permissions.
84+
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.
8185

8286
## What makes JavaScript unique?
8387

@@ -86,14 +90,13 @@ There are at least *three* great things about JavaScript:
8690
```compare
8791
+ Full integration with HTML/CSS.
8892
+ Simple things are done simply.
89-
+ Supported by all major browsers and enabled by default.
93+
+ Support by all major browsers and enabled by default.
9094
```
95+
JavaScript is the only browser technology that combines these three things.
9196

92-
Combined, these three things exist only in JavaScript and no other browser technology.
97+
That's what makes JavaScript unique. That's why it's the most widespread tool for creating browser interfaces.
9398

94-
That's what makes JavaScript unique. That's why it's the most widespread tool to create browser interfaces.
95-
96-
While planning to learn a new technology, it's beneficial to check its perspectives. So let's move on to the modern trends that include new languages and browser abilities.
99+
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.
97100

98101

99102
## Languages "over" JavaScript
@@ -108,14 +111,14 @@ Modern tools make the transpilation very fast and transparent, actually allowing
108111

109112
Examples of such languages:
110113

111-
- [CoffeeScript](http://coffeescript.org/) is a "syntactic sugar" for JavaScript, it introduces shorter syntax, allowing to write more precise and clear code. Usually Ruby devs like it.
112-
- [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.
114+
- [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.
115+
- [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.
113116
- [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.
114117

115-
There are more. Of course, even if we use one of those languages, we should also know JavaScript, to really understand what we're doing.
118+
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.
116119

117120
## Summary
118121

119-
- JavaScript was initially created as a browser-only language, but now it is used in many other environments as well.
120-
- At this moment, JavaScript has a unique position as the most widely-adopted browser language with full integration with HTML/CSS.
122+
- JavaScript was initially created as a browser-only language, but is now used in many other environments as well.
123+
- Today, JavaScript has a unique position as the most widely-adopted browser language with full integration with HTML/CSS.
121124
- 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.
-480 Bytes
Loading
Loading

1-js/01-getting-started/2-code-editors/article.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,22 @@
22

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

5-
There are two archetypes: IDE and lightweight editors. Many people feel comfortable choosing one tool of each type.
5+
There are two main types of code editors: IDEs and lightweight editors. Many people use one tool of each type.
66

77
## IDE
88

9-
The term [IDE](https://en.wikipedia.org/wiki/Integrated_development_environment) (Integrated Development Environment) means a powerful editor with many features that usually operates on a "whole project." As the name suggests, that's not just an editor, but a full-scale "development environment."
9+
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."
1010

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

13-
If you haven't considered selecting an IDE yet, look at the following variants:
13+
If you haven't selected an IDE yet, consider the following options:
1414

15-
- [WebStorm](http://www.jetbrains.com/webstorm/) for frontend development and other editors of the same company if you need additional languages (paid).
16-
- [Visual Studio Code](https://code.visualstudio.com/) (free).
17-
- [Netbeans](http://netbeans.org/) (paid).
15+
- [WebStorm](http://www.jetbrains.com/webstorm/) for frontend development. The same company offers other editors for other languages (paid).
16+
- [Netbeans](http://netbeans.org/) (free).
1817

19-
All of the IDEs are cross-platform.
18+
All of these IDEs are cross-platform.
2019

21-
For Windows, there's also a "Visual Studio" editor, don't confuse it with "Visual Studio Code." "Visual Studio" is a paid and mighty Windows-only editor, well-suited for the .NET platform. A free version of it is called ([Visual Studio Community](https://www.visualstudio.com/vs/community/).
20+
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. A free version of it is called [Visual Studio Community](https://www.visualstudio.com/vs/community/).
2221

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

@@ -34,7 +33,7 @@ In practice, lightweight editors may have a lot of plugins including directory-l
3433

3534
The following options deserve your attention:
3635

37-
- [Visual Studio Code](https://code.visualstudio.com/) (cross-platform, free).
36+
- [Visual Studio Code](https://code.visualstudio.com/) (cross-platform, free) also has many IDE-like features.
3837
- [Atom](https://atom.io/) (cross-platform, free).
3938
- [Sublime Text](http://www.sublimetext.com) (cross-platform, shareware).
4039
- [Notepad++](https://notepad-plus-plus.org/) (Windows, free).
@@ -46,7 +45,7 @@ The personal preference of the author is to have both an IDE for projects and a
4645

4746
I'm using:
4847

49-
- [WebStorm](http://www.jetbrains.com/webstorm/) for JS, and if there is one more language in the project, then I switch to one of the other JetBrains offerings listed above.
48+
- As an IDE for JS -- [WebStorm](http://www.jetbrains.com/webstorm/) (I switch to one of the other JetBrains offerings when using other languages)
5049
- As a lightweight editor -- [Sublime Text](http://www.sublimetext.com) or [Atom](https://atom.io/).
5150

5251
## Let's not argue
@@ -55,4 +54,4 @@ The editors in the lists above are those that either I or my friends whom I cons
5554

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

58-
The choice of an editor, like any other tool, is individual and depends on your projects, habits, personal preferences.
57+
The choice of an editor, like any other tool, is individual and depends on your projects, habits, and personal preferences.

1-js/01-getting-started/3-devtools/article.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Developer console
22

3-
Code is prone to errors. You are quite likely to make errors... Oh, what am I talking about? You are *absolutely* going to make errors, at least if you're a human, not a [robot](https://en.wikipedia.org/wiki/Bender_(Futurama)).
3+
Code is prone to errors. You will quite likely make errors... Oh, what am I talking about? You are *absolutely* going to make errors, at least if you're a human, not a [robot](https://en.wikipedia.org/wiki/Bender_(Futurama)).
44

5-
But in the browser, a user doesn't see the errors by default. So, if something goes wrong in the script, we won't see what's broken and can't fix it.
5+
But in the browser, users don't see errors by default. So, if something goes wrong in the script, we won't see what's broken and can't fix it.
66

77
To see errors and get a lot of other useful information about scripts, "developer tools" have been embedded in browsers.
88

9-
Most often developers lean towards Chrome or Firefox for development because those browsers have the best developer tools. Other browsers also provide developer tools, sometimes with special features, but are usually playing "catch-up" to Chrome or Firefox. So most people have a "favorite" browser and switch to others if a problem is browser-specific.
9+
Most developers lean towards Chrome or Firefox for development because those browsers have the best developer tools. Other browsers also provide developer tools, sometimes with special features, but are usually playing "catch-up" to Chrome or Firefox. So most developers have a "favorite" browser and switch to others if a problem is browser-specific.
1010

11-
Developer tools are potent; there are many features. To start, we'll learn how to open them, look at errors and run JavaScript commands.
11+
Developer tools are potent; they have many features. To start, we'll learn how to open them, look at errors, and run JavaScript commands.
1212

1313
## Google Chrome
1414

@@ -31,28 +31,34 @@ The exact look of developer tools depends on your version of Chrome. It changes
3131

3232
Below the error message, there is a blue `>` symbol. It marks a "command line" where we can type JavaScript commands. Press `key:Enter` to run them (`key:Shift+Enter` to input multi-line commands).
3333

34-
Now we can see errors, and that's enough for a start. We'll be back to developer tools later and cover debugging more in-depth in the chapter <info:debugging-chrome>.
34+
Now we can see errors, and that's enough for a start. We'll come back to developer tools later and cover debugging more in-depth in the chapter <info:debugging-chrome>.
3535

3636

3737
## Firefox, Edge, and others
3838

3939
Most other browsers use `key:F12` to open developer tools.
4040

41-
The look & feel of them is quite similar. Once you know how to use one of those tools (you can start with Chrome), you can easily switch to another.
41+
The look & feel of them is quite similar. Once you know how to use one of these tools (you can start with Chrome), you can easily switch to another.
4242

4343
## Safari
4444

4545
Safari (Mac browser, not supported by Windows/Linux) is a little bit special here. We need to enable the "Develop menu" first.
4646

47-
Open Preferences and go to "Advanced" pane. There's a checkbox at the bottom:
47+
Open Preferences and go to the "Advanced" pane. There's a checkbox at the bottom:
4848

4949
![safari](safari.png)
5050

5151
Now `key:Cmd+Opt+C` can toggle the console. Also, note that the new top menu item named "Develop" has appeared. It has many commands and options.
5252

53+
## Multi-line input
54+
55+
Usually, when we put a line of code into the console, and then press `key:Enter`, it executes.
56+
57+
To insert multiple lines, press `key:Shift+Enter`.
58+
5359
## Summary
5460

55-
- Developer tools allow us to see errors, run commands, examine variables and much more.
56-
- They can be opened with `key:F12` for most browsers under Windows. Chrome for Mac needs `key:Cmd+Opt+J`, Safari: `key:Cmd+Opt+C` (need to enable first).
61+
- Developer tools allow us to see errors, run commands, examine variables, and much more.
62+
- They can be opened with `key:F12` for most browsers on Windows. Chrome for Mac needs `key:Cmd+Opt+J`, Safari: `key:Cmd+Opt+C` (need to enable first).
5763

5864
Now we have the environment ready. In the next section, we'll get down to JavaScript.

0 commit comments

Comments
 (0)