JavaScript – first impression

Java programming language or Java script – JavaScript – was created by a fun programmer in 10 days. Almost as God created the Earth, so Brendan Eich created a programming language in 1995 that is compatible with all browsers and is still the most popular programming language for web applications and websites.

JavaScript language features:

  • interpretive
  • register (case) sensitive
  • embedded in html, etc.

The core of the language is ECMAScript-262, where the main constructs and syntax are described.

How to start talking to the JavaScript interpreter in the browser? For example, in Google Chrome, you can press F12 to open developer tools. Select the Console tab – this is the JavaScript interpreter built into the browser.

Useful hotkey:

Ctrl+L – clean up old code

JavaScript has numbers (number) and strings (string).

All numbers in JavaScript are of type number, no matter how the number is written.

Grouping operator: ( )

Arithmetic operators: +, -, *, /, % (integer remainder of division)

An operand is something with which operations are performed.

Binary operator: 5+5

Unary operator: +5

Important: a dot is used to write numbers with a comma – 5.1

String – any character set, text

‘ Cat’, “Cat” (you can use single or double quotes)

To display text on different lines, use the \n special character – transfer to a new line.

Example: “Hi, \ncat”

Tabulation is specified using the special character \t

Escaping characters, for example, we want to use double quotes inside double quotes, for example, “Cat has “Vera” kitten”, then you need to cover the inner quotes with a backslash \ – “Cat has \”Vera\” kitten”

If I want the backslash character itself to appear, then it also needs to be escaped: “Cat has \\Vera\\ kitten”, otherwise the interpreter will not show this slash, it will simply consider it an escape of some special character that is not actually here .

Everything in JavaScript is stored in Unicode!

Example: “Cat \u2014 Vera” – we will see “Cat – Vera”

String concatenation (addition)

“cat” + ” ” + “Vera” (in this case, plus is the concatenation operator)

This entry was posted in Javascript (en). Bookmark the permalink.

Leave a Reply

🇬🇧 Attention! Comments with URLs/email are not allowed.
🇷🇺 Комментарии со ссылками/email удаляются автоматически.