Compare commits
29 Commits
master
...
Lesson_Beg
Author | SHA1 | Date |
---|---|---|
|
16f790a9d9 | |
|
ca5807d864 | |
|
8cd0772025 | |
|
507e1f5106 | |
|
0773b73f34 | |
|
450c6d746b | |
|
499b3c97bc | |
|
6e22791d14 | |
|
56ae848aee | |
|
706feb8bd6 | |
|
1139f8acbd | |
|
30be821446 | |
|
d10df6e533 | |
|
417acb8e4b | |
|
5bef125273 | |
|
3071bb4746 | |
|
94e33222b2 | |
|
7e7301b1ab | |
|
abc5eecbe6 | |
|
b3d2bbb9da | |
|
edfa057838 | |
|
68be4c01bf | |
|
b0eb9c869a | |
|
03c74d8769 | |
|
5509a95a6e | |
|
5293c1ee31 | |
|
7f67cd98ca | |
|
16cc913cad | |
|
4f1310bbcf |
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Launch Program",
|
||||||
|
"skipFiles": [
|
||||||
|
"<node_internals>/**"
|
||||||
|
],
|
||||||
|
"program": "${workspaceFolder}\\src\\index.ts",
|
||||||
|
"outFiles": [
|
||||||
|
"${workspaceFolder}/**/*.js"
|
||||||
|
],
|
||||||
|
"preLaunchTask": "build_backend"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "build_backend",
|
||||||
|
"type": "npm",
|
||||||
|
"script": "build",
|
||||||
|
"path": "/",
|
||||||
|
"problemMatcher": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
90
src/index.ts
90
src/index.ts
|
@ -118,3 +118,93 @@ for (let item of array2) {
|
||||||
|
|
||||||
array2.filter(item => "eat" in item);
|
array2.filter(item => "eat" in item);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Обучение ЦИКЛАМ
|
||||||
|
|
||||||
|
//lesson 1.5 SUM OF NUMBERS
|
||||||
|
|
||||||
|
function CalculateRectangleArea(sideA: number, sideB: number) : number {
|
||||||
|
return sideA * sideB;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Virtual console
|
||||||
|
let chisloOne: string = '2';
|
||||||
|
let chisloTwo: string = 'A';
|
||||||
|
|
||||||
|
//Solution
|
||||||
|
let sideA = Number.parseInt(chisloOne, 10);
|
||||||
|
let sideB = Number.parseInt(chisloTwo, 10);
|
||||||
|
|
||||||
|
// && - AND
|
||||||
|
// || - OR
|
||||||
|
// !
|
||||||
|
if (Number.isNaN(sideA) || sideA <= 0 ){
|
||||||
|
console.log(`Your first value is invalid: ${sideA}`)
|
||||||
|
}
|
||||||
|
if (Number.isNaN(sideB) || sideB <= 0){
|
||||||
|
console.log(`Your second value is invalid: ${sideB}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
else{
|
||||||
|
console.log(`Area of rectangle is: ${CalculateRectangleArea(sideA, sideB)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
//## ЗАДАЧА ##
|
||||||
|
//Если выписать все натуральные числа меньше 10, кратные 3, или 5, то получим 3, 5, 6 и 9.
|
||||||
|
//Сумма этих чисел будет равна 23.
|
||||||
|
//Напишите программу, которая выводит на экран сумму всех чисел меньше 1000, кратных 3, или 5.
|
||||||
|
|
||||||
|
//#1 натуральное число от 1 до 10 (числа которые
|
||||||
|
//#2 Натуральные числа (от лат. naturalis — «естественный») — числа, возникающие естественным образом при счёте. Примеры: 1, 2, 3, 4, 5, 6, 7 и)
|
||||||
|
//#3 Числа, кратные 3, или 5 — это числа, которые делятся на 3 или на 5 без остатка.
|
||||||
|
|
||||||
|
function SUMMA (chislo: number){
|
||||||
|
let result = 5;
|
||||||
|
console.log(`summa of numbre <1000: ${result}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
function DrawLine(count: number, countP: number){ //рисуем треугольник из звездочек
|
||||||
|
const minimalString = '*';
|
||||||
|
const minimalP = ' ';
|
||||||
|
|
||||||
|
let result = minimalP.repeat(countP) + minimalString.repeat(count) //с начала рисуем пробелы (countP) а потом зведочки
|
||||||
|
console.log(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
function DrawTriangle(height: number, chisloP: number) { //высота - это сколько рядов отрисует
|
||||||
|
for(let index = 1; index <= height; ){
|
||||||
|
DrawLine(index * 2 - 1, chisloP - index ); // вызываем функцию DrawLine внутри цикла, chisloN - нужно иметь МАКС значение как в первом уроке
|
||||||
|
index = index +1;
|
||||||
|
//console.log(height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rl.question('Enter something', value => {
|
||||||
|
console.log(`Hi ${value}`);
|
||||||
|
rl.close;
|
||||||
|
});
|
||||||
|
*/
|
|
@ -0,0 +1,19 @@
|
||||||
|
import readline from 'node:readline';
|
||||||
|
|
||||||
|
export function ConsoleInput(text: string): string {
|
||||||
|
|
||||||
|
let result: string = '';
|
||||||
|
|
||||||
|
const rl = readline.createInterface({
|
||||||
|
input: process.stdin,
|
||||||
|
output: process.stdout,
|
||||||
|
});
|
||||||
|
|
||||||
|
rl.question('Enter something:', value => {
|
||||||
|
result = value;
|
||||||
|
rl.close;
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
"strict": true, /* Enable all strict type-checking options. */
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
||||||
/* Completeness */
|
/* Completeness */
|
||||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
|
||||||
|
"sourceMap": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue