From d191407726a3959aef524e5a34bd6b8a6e31ad36 Mon Sep 17 00:00:00 2001 From: Maaxym Date: Thu, 19 Jul 2018 23:59:32 +0300 Subject: [PATCH 1/2] homework number 15 --- js-core/homeworks/homework-15/index.html | 147 ++++++++++++++++++++++ js-core/homeworks/homework-15/src/main.js | 75 +++++++++++ 2 files changed, 222 insertions(+) create mode 100644 js-core/homeworks/homework-15/index.html create mode 100644 js-core/homeworks/homework-15/src/main.js diff --git a/js-core/homeworks/homework-15/index.html b/js-core/homeworks/homework-15/index.html new file mode 100644 index 0000000..6194bdc --- /dev/null +++ b/js-core/homeworks/homework-15/index.html @@ -0,0 +1,147 @@ + + + + + Home work 15 + + + + + +
+
+

Contacts

+
+
+ +
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameLast nameEmail
ИванПетровIvanPetrov@ec.ua
СергейСергеевSergeiSergeev@ec.ua
ИванИвановIvanIvanov@ec.ua
АлександрАлександровAlexAlex@ec.ua
АлексСмирновAlexSmirnov@ec.ua
СергейВолковVolkovSergey@ec.ua
МарияШараповаMariyaSharapova@ec.ua
АлександрВинникAlexVinnik@ec.ua
ДарийСмирновDariySmirnov@ec.ua
ЕленаЛещенкоElenaLeshenko@ec.ua
ОльгаНовиковаOlgaNovikova@ec.ua
НатальяШемякинаShemyakinaN@ec.ua
АннаДонцоваAnnaDontsova@ec.ua
ВладЯмаVladYama@ec.ua
КираВоробьеваKira1990@ec.ua
ВикторКривенкоViktorKriv@ec.ua
+
+
+ + + + + diff --git a/js-core/homeworks/homework-15/src/main.js b/js-core/homeworks/homework-15/src/main.js new file mode 100644 index 0000000..213c770 --- /dev/null +++ b/js-core/homeworks/homework-15/src/main.js @@ -0,0 +1,75 @@ +/* +TASK 0 +Проверьте что строка содержит все символы от "a" до "z" + solution("wyyga") // false + solution("y") // true + solution("ejuxggfsts") // false + solution("qpwoeirutyalskdjfhgmznxbcv") // true + solution("qqqqqqqqpwoeirutyallskkdjfhgmmznxbcv") // true + solution("0123456789abcdefghijklmnop") // false +*/ + +const solution = str => { + if(str.length<26){ + return false; + } + let letters = 'abcdefghijklmnopqrstuvwxyz'; + for( let i=0; i [1, 2, 3, 4, 5, 10] + [25, 10, [10, [15]]] => [25, 10, 10, 15] + [1, [2, [ {a: "b", c: 'd' }, { c: [1, 2, 5] } ] ] ] => [1, 2, {a: "b"}] + */ + +//#1 arr == [...] flattenedArray = [1] + flatten = [2, [{a: "b"}, { c: 'd' }]] +//#2 arr == [2, [ {a: "b"}, { c: 'd' } ] ] flattenedArray = [2] + flatten == [{a: "b"}, { c: 'd' }] +//#3 arr == [ {a: "b"}, { c: 'd' } ] flattenedArray = [{a: "b"}, { c: 'd' }] +//# +const flatten = arr => { + let res = []; + function subFlatten(arr){ + arr.forEach(function(value){ + if(!Array.isArray(value)){ + res.push(value); + }else{ + subFlatten(value); + } + }); + } + subFlatten(arr); + return res; +}; + +console.log(flatten([[1,2],[3,[4]],5, 10])); +console.log(flatten([25, 10, [10, [15]]])); +console.log(flatten([1, [2, [ {a: "b", c: 'd' }, { c: [1, 2, 5] } ] ] ])); + + +/* +Виртуализировать таблицу, сделать рендер всей +таблицы через JavaScript. +Второй макет. +https://github.com/aleksandra-maslennikova/telephone-book/blob/master/index.html +Выглядеть должно так же: https://aleksandra-maslennikova.github.io/telephone-book/index.html +*/ \ No newline at end of file From 12f8713a4a7dc985cca611b633ebe36675a43b81 Mon Sep 17 00:00:00 2001 From: Maaxym Date: Sun, 22 Jul 2018 16:17:03 +0300 Subject: [PATCH 2/2] changes applied after review --- js-core/homeworks/homework-15/src/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js-core/homeworks/homework-15/src/main.js b/js-core/homeworks/homework-15/src/main.js index 213c770..8884763 100644 --- a/js-core/homeworks/homework-15/src/main.js +++ b/js-core/homeworks/homework-15/src/main.js @@ -48,8 +48,8 @@ console.log('0123456789abcdefghijklmnop',solution("0123456789abcdefghijklmnop") //# const flatten = arr => { let res = []; - function subFlatten(arr){ - arr.forEach(function(value){ + let subFlatten = arr => { + arr.forEach( value => { if(!Array.isArray(value)){ res.push(value); }else{