From 0444296c649a7ae717e441dc710f50d49162ab05 Mon Sep 17 00:00:00 2001 From: elidiany Date: Sun, 20 Mar 2022 20:22:57 +0900 Subject: [PATCH 1/7] Labs tasks 1 --- Exercises/1-let.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exercises/1-let.js b/Exercises/1-let.js index d705443..011cc55 100644 --- a/Exercises/1-let.js +++ b/Exercises/1-let.js @@ -1,5 +1,5 @@ 'use strict'; -let name = undefined; +let name = 'Michil'; module.exports = { name }; From 20e831906158fae43bd63f91d41f575eb65858d2 Mon Sep 17 00:00:00 2001 From: elidiany Date: Sun, 20 Mar 2022 20:36:53 +0900 Subject: [PATCH 2/7] Labs tasks 2 --- Exercises/2-const.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exercises/2-const.js b/Exercises/2-const.js index 5512738..0041b5a 100644 --- a/Exercises/2-const.js +++ b/Exercises/2-const.js @@ -1,5 +1,5 @@ 'use strict'; -const year = undefined; +const year = 2000; module.exports = { year }; From d3c68be890e06057cdc30cfb5aedf9544f892534 Mon Sep 17 00:00:00 2001 From: elidiany Date: Sun, 20 Mar 2022 20:42:54 +0900 Subject: [PATCH 3/7] Labs tasks 3 --- Exercises/3-hello.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exercises/3-hello.js b/Exercises/3-hello.js index a597391..17b496b 100644 --- a/Exercises/3-hello.js +++ b/Exercises/3-hello.js @@ -1,5 +1,5 @@ 'use strict'; -const hello = null; +const hello = (name) => console.log(`Привет, ${name}`); module.exports = { hello }; From bf52da5c69b4d02a0f88cc3cc02a3786ffc67a40 Mon Sep 17 00:00:00 2001 From: elidiany Date: Sun, 20 Mar 2022 21:05:51 +0900 Subject: [PATCH 4/7] Labs task 4 --- Exercises/4-range.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Exercises/4-range.js b/Exercises/4-range.js index 31bd852..b78da6f 100644 --- a/Exercises/4-range.js +++ b/Exercises/4-range.js @@ -1,5 +1,10 @@ 'use strict'; -const range = null; - +const range = (start, end) => { + const massiv = []; + for (start; start <= end; start++) { + massiv.push(start); + } + return massiv; +}; module.exports = { range }; From 1ea2c1956297ff3f7a0e243b06e28fe4aed52368 Mon Sep 17 00:00:00 2001 From: elidiany Date: Sun, 20 Mar 2022 21:24:04 +0900 Subject: [PATCH 5/7] Labs task 5 --- Exercises/5-range-odd.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Exercises/5-range-odd.js b/Exercises/5-range-odd.js index 54bb5b4..db88eb4 100644 --- a/Exercises/5-range-odd.js +++ b/Exercises/5-range-odd.js @@ -1,5 +1,11 @@ 'use strict'; -const rangeOdd = null; +const rangeOdd = (start, end) => { + const massiv = []; + for (start; start <= end; start++) { + if (start % 2 !== 0) massiv.push(start); + } + return massiv; +}; module.exports = { rangeOdd }; From af937bda4ab121c246d947b425fb599ba99678f4 Mon Sep 17 00:00:00 2001 From: elidiany Date: Sun, 20 Mar 2022 22:56:48 +0900 Subject: [PATCH 6/7] Labs task 6 --- Exercises/6-calculate.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Exercises/6-calculate.js b/Exercises/6-calculate.js index dfecf6b..8be7dc0 100644 --- a/Exercises/6-calculate.js +++ b/Exercises/6-calculate.js @@ -1,11 +1,19 @@ 'use strict'; -const square = null; +const square = (x) => x * x; -const cube = null; +const cube = (x) => x ** 3; -const average = null; +const average = (a, b) => (a + b) / 2; -const calculate = null; +const calculate = () => { + const massiv = []; + for (let i = 0; i <= 9; i++) { + const znach1 = cube(i); + const znach2 = square(i); + massiv.push(average(znach1, znach2)); + } + return massiv; +}; module.exports = { square, cube, average, calculate }; From 1781bfd10d7310b31743a6e1970ae90d9174a0f4 Mon Sep 17 00:00:00 2001 From: elidiany Date: Mon, 21 Mar 2022 01:24:01 +0900 Subject: [PATCH 7/7] Labs tasks 7, 8, 9, a-hash --- Exercises/7-objects.js | 14 +++++++++++++- Exercises/8-create.js | 5 ++++- Exercises/9-array.js | 10 ++++++++-- Exercises/a-hash.js | 8 ++++++-- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Exercises/7-objects.js b/Exercises/7-objects.js index 0920026..ccc85e3 100644 --- a/Exercises/7-objects.js +++ b/Exercises/7-objects.js @@ -1,5 +1,17 @@ 'use strict'; -const fn = null; +const fn = () => { + const kek = { name: 'mich' }; + let lol = { + name: 'lyalya', + }; + kek.name = 'dada'; + lol.name = 'xoxoox'; + console.log(kek.name); + console.log(lol.name); + lol = { dada: 'asdsadsad' }; +}; + +fn(); module.exports = { fn }; diff --git a/Exercises/8-create.js b/Exercises/8-create.js index ac27ddd..52d3503 100644 --- a/Exercises/8-create.js +++ b/Exercises/8-create.js @@ -1,5 +1,8 @@ 'use strict'; -const createUser = null; +const createUser = (name, city) => { + const user = { name, city }; + return user; +}; module.exports = { createUser }; diff --git a/Exercises/9-array.js b/Exercises/9-array.js index 466c69a..33f9ab4 100644 --- a/Exercises/9-array.js +++ b/Exercises/9-array.js @@ -1,7 +1,13 @@ 'use strict'; -const phonebook = null; +const phonebook = [{ name: 'Michil', phone: '+79143053718' }, + { name: 'Lyulya', phone: '+79969156656' }]; -const findPhoneByName = null; +const findPhoneByName = (name) => { + for (const nam of phonebook) { + if (nam.name === name) return nam.phone; + } +}; +findPhoneByName('Lyulya'); module.exports = { phonebook, findPhoneByName }; diff --git a/Exercises/a-hash.js b/Exercises/a-hash.js index 466c69a..2f85bf2 100644 --- a/Exercises/a-hash.js +++ b/Exercises/a-hash.js @@ -1,7 +1,11 @@ 'use strict'; -const phonebook = null; +const phonebook = { + mich: '+79143053718', + lyalya: '+79969156656', +}; + +const findPhoneByName = (name) => phonebook(name); -const findPhoneByName = null; module.exports = { phonebook, findPhoneByName };