minor fixes
This commit is contained in:
parent
06cdd5b84a
commit
51edbb1236
3 changed files with 73 additions and 47 deletions
|
@ -1,33 +1,43 @@
|
|||
# Hello, JavaScript!
|
||||
|
||||
The programs in JavaScript are called *scripts*. They can be embedded right into HTML using `<script>` tag and run automatically as the page loads.
|
||||
JavaScript has a rich history.
|
||||
|
||||
For example, this HTML-page shows the "Hello" message:
|
||||
It was created in 1995 as a simple language exclusively for web browsers, to “make web pages alive”. Since then it has greatly evolved.
|
||||
|
||||
```html run
|
||||
Today we can use JavaScript on many platforms:
|
||||
|
||||
- In a web-browser, by embedding it into a web page.
|
||||
- On a general purpose computer or a server, using [Node.js](https://nodejs.org) and other means.
|
||||
- ...Or actually on any device that has a special piece of software, called "JavaScript engine".
|
||||
|
||||
Technically, even a coffee machine can include its own JavaScript engine to allow programming of coffee recipes.
|
||||
|
||||

|
||||
|
||||
There's a formal language description called [ECMAScript Language Specification](https://tc39.es/ecma262/), it describes how a JavaScript engine works. Sometimes we'll give references to it, but, though technically strict, it's hard to read for humans. At least at first.
|
||||
|
||||
Programs in JavaScript are called *scripts*.
|
||||
|
||||
Browsers have built-in JavaScript engines, so they can run scripts. They can be embedded right into HTML using the `<script>` tag and run automatically as the page loads.
|
||||
|
||||
For example, this HTML-page shows the "Hello, world!" message:
|
||||
|
||||
```html run height=0
|
||||
<!doctype html>
|
||||
<script>
|
||||
alert("Hello, world!");
|
||||
</script>
|
||||
```
|
||||
|
||||
JavaScript can execute not only in a browser, but also on a server, or actually on any device that has a special program called [the JavaScript engine](https://en.wikipedia.org/wiki/JavaScript_engine).
|
||||
|
||||
Browsers have built-in JavaScript engines, so they can run scripts.
|
||||
|
||||
We can also run scripts using [Node.js](https://nodejs.org), it's commonly used to build server-side applications.
|
||||
To see it in action, you can click the "run" button in the upper-right corner. Also you can create a new file, e.g. `my.html` with this text and open it locally in a browser.
|
||||
|
||||
Depending on the environment, JavaScript may provide platform-specific functionality.
|
||||
|
||||
- In a web browser, JavaScript can manipulate the web-page, send network requests, show messages and so on.
|
||||
- In a browser, JavaScript can manipulate the web-page, send network requests, show messages and so on.
|
||||
- In node.js we can use JavaScript to run a web-server, read and write arbitrary files.
|
||||
- ...And so on.
|
||||
|
||||
Technically, even a coffee machine can include its own JavaScript engine, to allow programming of coffee recipes.
|
||||
|
||||

|
||||
|
||||
**In this tutorial we concentrate on the "core JavaScript", that's the same everywhere.**
|
||||
**In this course we concentrate on the core JavaScript, that's the same everywhere.**
|
||||
|
||||
We'll try to keep browser-specific notes at minimum. After you learn the core, you can go in any direction: browsers, frameworks, servers and so on.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue