Skip to content

Commit

Permalink
Fix name of JavaScript
Browse files Browse the repository at this point in the history
  • Loading branch information
lex111 committed Apr 23, 2019
1 parent 3b14ed8 commit c5ce557
Show file tree
Hide file tree
Showing 32 changed files with 61 additions and 61 deletions.
4 changes: 2 additions & 2 deletions 1-js/01-getting-started/1-intro/article.md
Expand Up @@ -45,7 +45,7 @@ The engine applies optimizations at each step of the process. It even watches th

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

Expand Down Expand Up @@ -88,7 +88,7 @@ There are at least *three* great things about JavaScript:
+ Simple things are done simply.
+ Support by all major browsers and enabled by default.
```
Javascript is the only browser technology that combines these three things.
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.

Expand Down
4 changes: 2 additions & 2 deletions 1-js/06-advanced-functions/03-closure/article.md
Expand Up @@ -221,7 +221,7 @@ function sayHiBye(firstName, lastName) {
}
```

Here the *nested* function `getFullName()` is made for convenience. It can access the outer variables and so can return the full name. Nested functions are quite common in Javascript.
Here the *nested* function `getFullName()` is made for convenience. It can access the outer variables and so can return the full name. Nested functions are quite common in JavaScript.

What's much more interesting, a nested function can be returned: either as a property of a new object (if the outer function creates an object with methods) or as a result by itself. It can then be used somewhere else. No matter where, it still has access to the same outer variables.

Expand Down Expand Up @@ -473,7 +473,7 @@ The code outside of the block (or inside another script) doesn't see variables i

### IIFE

In the past, there were no block-level lexical environment in Javascript.
In the past, there were no block-level lexical environment in JavaScript.

So programmers had to invent something. And what they did is called "immediately-invoked function expressions" (abbreviated as IIFE).

Expand Down
2 changes: 1 addition & 1 deletion 1-js/06-advanced-functions/05-global-object/article.md
Expand Up @@ -79,7 +79,7 @@ No, it's not, because it may lead to naming conflicts: the same variable name ca

As of now, the multi-purpose `window` is considered a design mistake in the language.

Luckily, there's a "road out of hell", called "Javascript modules".
Luckily, there's a "road out of hell", called "JavaScript modules".

If we set `type="module"` attribute on a `<script>` tag, then such script is considered a separate "module" with its own top-level scope (lexical environment), not interfering with `window`.

Expand Down
4 changes: 2 additions & 2 deletions 1-js/08-prototypes/04-prototype-methods/article.md
Expand Up @@ -3,7 +3,7 @@

In the first chapter of this section, we mentioned that there are modern methods to setup a prototype.

The `__proto__` is considered outdated and somewhat deprecated (in browser-only part of the Javascript standard).
The `__proto__` is considered outdated and somewhat deprecated (in browser-only part of the JavaScript standard).

The modern methods are:

Expand Down Expand Up @@ -81,7 +81,7 @@ Why was `__proto__` replaced by the functions? That's an interesting question, r
```warn header="Don't reset `[[Prototype]]` unless the speed doesn't matter"
Technically, we can get/set `[[Prototype]]` at any time. But usually we only set it once at the object creation time, and then do not modify: `rabbit` inherits from `animal`, and that is not going to change.

And JavaScript engines are highly optimized to that. Changing a prototype "on-the-fly" with `Object.setPrototypeOf` or `obj.__proto__=` is a very slow operation, it breaks internal optimizations for object property access operations. So evade it unless you know what you're doing, or Javascript speed totally doesn't matter for you.
And JavaScript engines are highly optimized to that. Changing a prototype "on-the-fly" with `Object.setPrototypeOf` or `obj.__proto__=` is a very slow operation, it breaks internal optimizations for object property access operations. So evade it unless you know what you're doing, or JavaScript speed totally doesn't matter for you.
```
## "Very plain" objects
Expand Down
2 changes: 1 addition & 1 deletion 1-js/09-classes/01-class/article.md
Expand Up @@ -68,7 +68,7 @@ So, what exactly is a `class`? That's not an entirely new language-level entity

Let's unveil any magic and see what a class really is. That'll help in understanding many complex aspects.

In Javascript, a class is a kind of a function.
In JavaScript, a class is a kind of a function.

Here, take a look:

Expand Down
Expand Up @@ -55,9 +55,9 @@ In JavaScript, there are three types of properties and members:

In many other languages there also exist "protected" fields: accessible only from inside the class and those extending it. They are also useful for the internal interface. They are in a sense more widespread than private ones, because we usually want inheriting classes to gain access to properly do the extension.

Protected fields are not implemented in Javascript on the language level, but in practice they are very convenient, so they are emulated.
Protected fields are not implemented in JavaScript on the language level, but in practice they are very convenient, so they are emulated.

In the next step we'll make a coffee machine in Javascript with all these types of properties. A coffee machine has a lot of details, we won't model them to stay simple (though we could).
In the next step we'll make a coffee machine in JavaScript with all these types of properties. A coffee machine has a lot of details, we won't model them to stay simple (though we could).

## Protecting "waterAmount"

Expand Down Expand Up @@ -186,7 +186,7 @@ So protected fields are naturally inheritable. Unlike private ones that we'll se

[recent browser=none]

There's a finished Javascript proposal, almost in the standard, that provides language-level support for private properties and methods.
There's a finished JavaScript proposal, almost in the standard, that provides language-level support for private properties and methods.

Privates should start with `#`. They are only accessible from inside the class.

Expand Down Expand Up @@ -325,6 +325,6 @@ Hiding complexity
To hide internal interface we use either protected or public properties:

- Protected fields start with `_`. That's a well-known convention, not enforced at the language level. Programmers should only access a field starting with `_` from its class and classes inheriting from it.
- Private fields start with `#`. Javascript makes sure we only can access those from inside the class.
- Private fields start with `#`. JavaScript makes sure we only can access those from inside the class.

Right now, private fields are not well-supported among browsers, but can be polyfilled.
4 changes: 2 additions & 2 deletions 1-js/11-async/07-microtask-queue/article.md
Expand Up @@ -30,7 +30,7 @@ As said in the [specification](https://tc39.github.io/ecma262/#sec-jobs-and-job-
- The queue is first-in-first-out: tasks enqueued first are run first.
- Execution of a task is initiated only when nothing else is running.

Or, to say that simply, when a promise is ready, its `.then/catch/finally` handlers are put into the queue. They are not executed yet. Javascript engine takes a task from the queue and executes it, when it becomes free from the current code.
Or, to say that simply, when a promise is ready, its `.then/catch/finally` handlers are put into the queue. They are not executed yet. JavaScript engine takes a task from the queue and executes it, when it becomes free from the current code.

That's why "code finished" in the example above shows first.

Expand All @@ -54,7 +54,7 @@ Now the order is as intended.

## Event loop

In-browser Javascript, as well as Node.js, is based on an *event loop*.
In-browser JavaScript, as well as Node.js, is based on an *event loop*.

"Event loop" is a process when the engine sleeps and waits for events, then reacts on those and sleeps again.

Expand Down
2 changes: 1 addition & 1 deletion 1-js/11-async/08-async-await/article.md
Expand Up @@ -12,7 +12,7 @@ async function f() {
}
```

The word "async" before a function means one simple thing: a function always returns a promise. Even If a function actually returns a non-promise value, prepending the function definition with the "async" keyword directs Javascript to automatically wrap that value in a resolved promise.
The word "async" before a function means one simple thing: a function always returns a promise. Even If a function actually returns a non-promise value, prepending the function definition with the "async" keyword directs JavaScript to automatically wrap that value in a resolved promise.

For instance, the code above returns a resolved promise with the result of `1`, let's test it:

Expand Down
Expand Up @@ -5,7 +5,7 @@ There are many areas where we need random data.

One of them is testing. We may need random data: text, numbers etc, to test things out well.

In Javascript, we could use `Math.random()`. But if something goes wrong, we'd like to be able to repeat the test, using exactly the same data.
In JavaScript, we could use `Math.random()`. But if something goes wrong, we'd like to be able to repeat the test, using exactly the same data.

For that, so called "seeded pseudo-random generators" are used. They take a "seed", the first value, and then generate next ones using a formula. So that the same seed yields the same sequence, and hence the whole flow is easily reproducible. We only need to remember the seed to repeat it.

Expand Down
2 changes: 1 addition & 1 deletion 1-js/12-generators-iterators/1-generators/article.md
Expand Up @@ -462,7 +462,7 @@ If we don't catch the error there, then, as usual, it falls through to the outer
- Inside generators (only) there exists a `yield` operator.
- The outer code and the generator may exchange results via `next/yield` calls.

In modern Javascript, generators are rarely used. But sometimes they come in handy, because the ability of a function to exchange data with the calling code during the execution is quite unique.
In modern JavaScript, generators are rarely used. But sometimes they come in handy, because the ability of a function to exchange data with the calling code during the execution is quite unique.

Also, in the next chapter we'll learn async generators, which are used to read streams of asynchronously generated data in `for` loop.

Expand Down
Expand Up @@ -130,7 +130,7 @@ That's natural, as it expects to find `Symbol.iterator`, same as `for..of` witho

## Async generators

Javascript also provides generators, that are also iterable.
JavaScript also provides generators, that are also iterable.

Let's recall a sequence generator from the chapter [](info:generators). It generates a sequence of values from `start` to `end` (could be anything else):

Expand Down Expand Up @@ -358,4 +358,4 @@ In web-development we often meet streams of data, when it flows chunk-by-chunk.

We could use async generators to process such data, but there's also another API called Streams, that may be more convenient, as it provides special interfaces to transform the data and to pass it from one stream to another (e.g. download from one place and immediately send elsewhere). But they are also more complex.

Streams API not a part of Javascript language standard. Streams and async generators complement each other, both are great ways to handle async data flows.
Streams API not a part of JavaScript language standard. Streams and async generators complement each other, both are great ways to handle async data flows.
10 changes: 5 additions & 5 deletions 1-js/13-modules/01-modules-intro/article.md
Expand Up @@ -4,7 +4,7 @@
As our application grows bigger, we want to split it into multiple files, so called 'modules'.
A module usually contains a class or a library of useful functions.

For a long time, Javascript existed without a language-level module syntax. That wasn't a problem, because initially scripts were small and simple. So there was no need.
For a long time, JavaScript existed without a language-level module syntax. That wasn't a problem, because initially scripts were small and simple. So there was no need.

But eventually scripts became more and more complex, so the community invented a variety of ways to organize code into modules.

Expand Down Expand Up @@ -56,7 +56,7 @@ The browser automatically fetches and evaluates imports, then runs the script.

What's different in modules, compared to "regular" scripts?

There are core features, valid both for browser and server-side Javascript.
There are core features, valid both for browser and server-side JavaScript.

### Always "use strict"

Expand Down Expand Up @@ -222,7 +222,7 @@ In a module, top-level `this` is undefined, as opposed to a global object in non
There are also several browser-specific differences of scripts with `type="module"` compared to regular ones.
You may want skip those for now if you're reading for the first time, or if you don't use Javascript in a browser.
You may want skip those for now if you're reading for the first time, or if you don't use JavaScript in a browser.
### Module scripts are deferred
Expand Down Expand Up @@ -259,7 +259,7 @@ Please note: the second script actually works before the first! So we'll see `un
That's because modules are deferred, so way wait for the document to be processed. The regular scripts runs immediately, so we saw its output first.
When using modules, we should be aware that HTML-document can show up before the Javascript application is ready. Some functionality may not work yet. We should put transparent overlays or "loading indicators", or otherwise ensure that the visitor won't be confused because of it.
When using modules, we should be aware that HTML-document can show up before the JavaScript application is ready. Some functionality may not work yet. We should put transparent overlays or "loading indicators", or otherwise ensure that the visitor won't be confused because of it.
### Async works on inline scripts
Expand Down Expand Up @@ -350,7 +350,7 @@ Build tools do the following:
- Unreachable code removed.
- Unused exports removed ("tree-shaking").
- Development-specific statements like `console` and `debugger` removed.
- Modern, bleeding-edge Javascript syntax may be transformed to older one with similar functionality using [Babel](https://babeljs.io/).
- Modern, bleeding-edge JavaScript syntax may be transformed to older one with similar functionality using [Babel](https://babeljs.io/).
- The resulting file is minified (spaces removed, variables replaced with shorter named etc).
That said, native modules are also usable. So we won't be using Webpack here: you can configure it later.
Expand Down
2 changes: 1 addition & 1 deletion 1-js/13-modules/02-import-export/article.md
Expand Up @@ -29,7 +29,7 @@ For instance, here all exports are valid:
````smart header="No semicolons after export class/function"
Please note that `export` before a class or a function does not make it a [function expression](info:function-expressions-arrows). It's still a function declaration, albeit exported.
Most Javascript style guides recommend semicolons after statements, but not after function and class declarations.
Most JavaScript style guides recommend semicolons after statements, but not after function and class declarations.
That's why there should be no semicolons at the end of `export class` and `export function`.
Expand Down
Expand Up @@ -8,4 +8,4 @@ Create a colored clock like here:

[iframe src="solution" height=60]

Use HTML/CSS for the styling, Javascript only updates time in elements.
Use HTML/CSS for the styling, JavaScript only updates time in elements.
2 changes: 1 addition & 1 deletion 2-ui/5-loading/01-onload-ondomcontentloaded/article.md
Expand Up @@ -75,7 +75,7 @@ In the example above, we first see "Library loaded...", and then "DOM ready!" (a

```warn header="Scripts with `async`, `defer` or `type=\"module\"` don't block DOMContentLoaded"

Script attributes `async` and `defer`, that we'll cover [a bit later](info:script-async-defer), don't block DOMContentLoaded. [Javascript modules](info:modules) behave like `defer`, they don't block it too.
Script attributes `async` and `defer`, that we'll cover [a bit later](info:script-async-defer), don't block DOMContentLoaded. [JavaScript modules](info:modules) behave like `defer`, they don't block it too.

So here we're talking about "regular" scripts, like `<script>...</script>`, or `<script src="..."></script>`.
```
Expand Down
2 changes: 1 addition & 1 deletion 2-ui/5-loading/02-script-async-defer/article.md
Expand Up @@ -129,7 +129,7 @@ Async scripts are great when we integrate an independant third-party script into

## Dynamic scripts

We can also create a script dynamically using Javascript:
We can also create a script dynamically using JavaScript:

```js run
let script = document.createElement('script');
Expand Down
2 changes: 1 addition & 1 deletion 2-ui/5-loading/03-onload-onerror/article.md
Expand Up @@ -23,7 +23,7 @@ document.head.append(script);
...But how to run the function that is declared inside that script? We need to wait until the script loads, and only then we can call it.

```smart
For our own scripts we could use [Javascript modules](info:modules) here, but they are not widely adopted by third-party libraries.
For our own scripts we could use [JavaScript modules](info:modules) here, but they are not widely adopted by third-party libraries.
```

### script.onload
Expand Down
Expand Up @@ -246,7 +246,7 @@ The purpose of the `"sandbox"` attribute is only to *add more* restrictions. It

The `postMessage` interface allows windows to talk to each other no matter which origin they are from.

So, it's a way around the "Same Origin" policy. It allows a window from `john-smith.com` to talk to `gmail.com` and exchange information, but only if they both agree and call corresponding Javascript functions. That makes it safe for users.
So, it's a way around the "Same Origin" policy. It allows a window from `john-smith.com` to talk to `gmail.com` and exchange information, but only if they both agree and call corresponding JavaScript functions. That makes it safe for users.

The interface has two parts.

Expand Down
6 changes: 3 additions & 3 deletions 4-binary/01-arraybuffer-binary-arrays/article.md
Expand Up @@ -2,12 +2,12 @@

In web-development we meet binary data mostly while dealing with files (create, upload, download). Another typical use case is image processing.

That's all possible in Javascript, and binary operations are high-performant.
That's all possible in JavaScript, and binary operations are high-performant.

Although, there's a bit of confusion, because there are many classes. To name a few:
- `ArrayBuffer`, `Uint8Array`, `DataView`, `Blob`, `File`, etc.

Binary data in Javascript is implemented in a non-standard way, compared to other languages. But when we sort things out, everything becomes fairly simple.
Binary data in JavaScript is implemented in a non-standard way, compared to other languages. But when we sort things out, everything becomes fairly simple.

**The basic binary object is `ArrayBuffer` -- a reference to a fixed-length contiguos memory area.**

Expand Down Expand Up @@ -144,7 +144,7 @@ Here's the list of typed arrays:
- `Float32Array`, `Float64Array` -- for signed floating-point numbers of 32 and 64 bits.

```warn header="No `int8` or similar single-valued types"
Please note, despite of the names like `Int8Array`, there's no single-value type like `int`, or `int8` in Javascript.
Please note, despite of the names like `Int8Array`, there's no single-value type like `int`, or `int8` in JavaScript.

That's logical, as `Int8Array` is not an array of these individual values, but rather a view on `ArrayBuffer`.
```
Expand Down
2 changes: 1 addition & 1 deletion 4-binary/02-text-decoder/article.md
Expand Up @@ -2,7 +2,7 @@

What if the binary data is actually a string? For instance, we received a file with textual data.

The build-in [TextDecoder](https://encoding.spec.whatwg.org/#interface-textdecoder) object allows to read the value into an an actual Javascript string, given the buffer and the encoding.
The build-in [TextDecoder](https://encoding.spec.whatwg.org/#interface-textdecoder) object allows to read the value into an an actual JavaScript string, given the buffer and the encoding.

We first need to create it:
```js
Expand Down

0 comments on commit c5ce557

Please sign in to comment.