Javascript programming for beginners. JavaScript tutorial for beginners from Dmitry Trepachev. What is JavaScript, or how to understand for what purpose it is needed in web development

  • how to insert a script into an HTML document (general information);
  • comments in JavaScript;
  • how to declare variables and give them correct names;
  • script parsing and method syntax;
  • alert() method;
  • useful detail: “stub” for a temporarily broken link
From the author

There are many different subtleties in creating web pages. But there are also three pillars. These are HTML, CSS and JavaScript.

I recommend organizing your self-education as follows: as soon as you master the HTML syntax and learn how to make primitive pages with text, pictures and tables, immediately start learning CSS. Once you understand how to work with CSS, start mastering JavaScript, while simultaneously improving lexicon» in all three languages. I think that in six months you will be able to build a very beautiful and functional website.

For a long time I didn’t know how to approach JavaScript. I came across textbooks that were either too abstract - theory, theory, and it was unclear how to apply it to practice, or, on the contrary, too specific: here's a set for you ready-made recipes, take it and use it, but how it all turns is none of your business.

I somehow came across a textbook by Vadim Dunaev. Many people, I know, criticize this textbook. In addition, I downloaded a disgusting scanned PDF, where instead of “()” there could be, for example, “Q”, and the Latin letters in the codes were replaced (in places!) by similar Russian ones, which is why these codes do not work. In general, I had to puff. And, to be honest, if I had not read anything about JavaScript before, I would not have understood these errors and would have joined the ranks of the scolders. But I was unemployed at the time, I had time to get into it, and I liked the textbook. But it is very detailed and designed for people who have already come into contact with programming.

Note 2012

Now, after several years, I still regard this textbook without the same enthusiasm. It is outdated, “tailored” for IE, and quite superficial; There are also real errors and sloppiness in the code, and some useful things are not found. But compared to those “goofy-goofy guides” that search engines produced in abundance, this was something.

So, I want to try to kill two birds with one stone. Write something understandable for any teapot and at the same time constructive and educational. So that this teapot, based on my advice, can write a simple but completely original script.

Inserting into an HTML document

You've probably seen the following tags in HTML codes:

This abracadabra between the tags is the script.

The tag itself belongs to the HTML language, and it can have the following attributes:

  • language
  • type

This attribute is optional. It should be used either to specify the language version (javascript1.1, javascript1.2, etc.), or if you are using another language (for example,