Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md

This file was deleted.

32 changes: 32 additions & 0 deletions task01.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
'use strict'
//пример 1
let a = 1, b = 1, c, d
c = ++a // Сначала увеличивается А на 1,затем результат кладется в С. Т.е. А = 2, С = 2
alert(c) // Ответ: 2

//пример 2
d = b++ // Сначала увеличивается B кладется в D, затем B увеличивается на 1. Т.е. D = 1, B = 2
alert(d) // Ответ: 1

//пример 3
c = 2 + ++a // Сначала увеличивается А на 1, затем 2 + A. Т.е. A = 3, C = 5
alert(c) // Ответ: 5

//пример 4
d = 2 + b++// Сначала увеличивается 2 + B, затем увеличиваем B на 1. Т.е. D = 4, B = 3
alert(d) // Ответ: 4

alert(a) // Ответ: 3
alert(b) // Ответ: 3

</script>
</body>
</html>
14 changes: 14 additions & 0 deletions task02.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
'use strict'
let a = 2
let x = 1 + (a *= 2) //Умножаем А на 2 и кладем в А. Прибавляем А + 1 и кладем в Х. Результат Х = 5
</script>
</body>
</html>
24 changes: 24 additions & 0 deletions task03.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>Document</title>
</head>

<body>
<script>
'use strict'
let a = -5
let b = -6
if(a >= 0 && b >= 0){
alert(a-b)
} else if(a < 0 && b < 0){
alert(a*b)
} else { //Условие, которое будет выполняться при разных знаках
alert(a+b)
}
</script>
</body>

</html>
37 changes: 37 additions & 0 deletions task04.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>Document</title>
</head>

<body>
<script>
'use strict'
function sum(a, b) {
return a + b
}

function dif(a, b) {
return a - b
}

function div(a, b) {
return a / b
}

function mul(a, b) {
return a * b
}

let a = 4
let b = 3
alert(sum(a,b))
alert(dif(a,b))
alert(div(a,b))
alert(mul(a,b))
</script>
</body>

</html>
49 changes: 49 additions & 0 deletions task05.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
'use strict'
function sum(a, b) {
return a + b
}

function dif(a, b) {
return a - b
}

function div(a, b) {
return a / b
}

function mul(a, b) {
return a * b
}

function mathOperation(arg1, arg2, operation){
switch(operation){
case '+':
return sum(arg1,arg2)
break
case '-':
return dif(arg1,arg2)
break
case '/':
return div(arg1,arg2)
break
case '*':
return mul(arg1,arg2)
break
}
}

alert(mathOperation(4, 3, '+'))
alert(mathOperation(4, 3, '-'))
alert(mathOperation(4, 3, '/'))
alert(mathOperation(4, 3, '*'))
</script>
</body>
</html>
39 changes: 39 additions & 0 deletions task06.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
'use strict'
function getResultString(Num){
let str_num = String(Num)
let last_char = str_num.charAt(str.length-1)
let pre_last_char
if(str_num.length > 1){
pre_last_char = str_num.charAt(str.length-2)
}
//если от 10 до 19 то рублей
if(pre_last_char == '1'){
return Num + ' рублей'
}
//если остальные варианты то проверяем
switch(last_char){
case '2':
case '3':
case '4':
return Num + ' рубля'
case '1':
return Num + ' рубль'
default :
return Num + ' рублей'
}
}

let str = prompt("введите сумму")
alert(getResultString(str))

</script>
</body>
</html>