RUVIDEO
Поделитесь видео 🙏

TypeScript basics Revision 4: Operators - Arithmetic operators

The provided code demonstrates various arithmetic and assignment operators in JavaScript. Let's go through each section step by step:

1. **Addition**:
- It initializes two variables `n1` and `n2` with values 1 and 2.
- Then, it uses the `+` operator to add `n1` and `n2`, and the result is logged to the console.
- The output will be `3`.
- Afterward, it initializes `str1` as 1 and `str2` as "2" and adds them together.
- JavaScript performs type coercion and converts `str1` to a string to concatenate with `str2`, resulting in `"12"` being logged to the console.

2. **Subtraction**:
- It initializes two variables `subn1` and `subn2` with values 5 and 2.
- Then, it uses the `-` operator to subtract `subn2` from `subn1`, and the result is logged to the console.
- The output will be `3`.

3. **Multiplication**:
- It initializes two variables `muln1` and `muln2` with values 5 and 2.
- Then, it uses the `*` operator to multiply `muln1` and `muln2`, and the result is logged to the console.
- The output will be `10`.

4. **Division**:
- It initializes two variables `divn1` and `divn2` with values 6 and 2.
- Then, it uses the `/` operator to divide `divn1` by `divn2`, and the result is logged to the console.
- The output will be `3`.

5. **Exponentiation**:
- It initializes two variables `expn1` and `expn2` with values 2 and 4.
- Then, it uses the `**` operator to calculate `expn1` raised to the power of `expn2`, and the result is logged to the console.
- The output will be `16`.

6. **Modulus**:
- It initializes two variables `modn1` and `modn2` with values 10 and 3.
- Then, it uses the `%` operator to find the remainder when `modn1` is divided by `modn2`, and the result is logged to the console.
- The output will be `1`.

7. **Increment and Decrement Operators**:
- It demonstrates the use of the `++` and `--` operators to increment and decrement variables. In the given examples, `counta` is incremented from 5 to 6, and `countb` is decremented from 10 to 9.

8. **Assignment Operators**:
- It shows the use of assignment operators like `+=` and `-=` to modify the value of a variable. `n` is initially set to 15, then it is incremented by 5 (`n += 5`) to become 20, and finally, it is decremented by 5 (`n -= 5`) to return to 15.

In JavaScript, the `typeof` operator is used to determine the type of a variable or expression. In your code, it's used to determine the type of `str2`, which is a string. Therefore, `typeof str2` will output `"string"`.



#JavaScript
#ProgrammingBasics
#typescript
#ArithmeticOperators
#AssignmentOperators
#TypeCoercion
#Variables
#typescript
#IncrementDecrement
#Exponentiation
#typescript ModulusOperator
#CodeExamples
#TypeScript (for the TypeScript example)
#CodingTips
#WebDevelopment
#LearningJavaScript
#Coding101

These hashtags should help you find and share content related to the code examples and programming concepts discussed in your provided code.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «TypeScript basics Revision 4: Operators - Arithmetic operators», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.