Skip to content

Reusable done #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion Exercises/1-let.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

let name = undefined;
let name = 'Michil';

module.exports = { name };
2 changes: 1 addition & 1 deletion Exercises/2-const.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

const year = undefined;
const year = 2000;

module.exports = { year };
2 changes: 1 addition & 1 deletion Exercises/3-hello.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

const hello = null;
const hello = (name) => console.log(`Привет, ${name}`);

module.exports = { hello };
9 changes: 7 additions & 2 deletions Exercises/4-range.js
Original file line number Diff line number Diff line change
@@ -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 };
8 changes: 7 additions & 1 deletion Exercises/5-range-odd.js
Original file line number Diff line number Diff line change
@@ -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 };
16 changes: 12 additions & 4 deletions Exercises/6-calculate.js
Original file line number Diff line number Diff line change
@@ -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 };
14 changes: 13 additions & 1 deletion Exercises/7-objects.js
Original file line number Diff line number Diff line change
@@ -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 };
5 changes: 4 additions & 1 deletion Exercises/8-create.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
'use strict';

const createUser = null;
const createUser = (name, city) => {
const user = { name, city };
return user;
};

module.exports = { createUser };
10 changes: 8 additions & 2 deletions Exercises/9-array.js
Original file line number Diff line number Diff line change
@@ -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 };
8 changes: 6 additions & 2 deletions Exercises/a-hash.js
Original file line number Diff line number Diff line change
@@ -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 };