-
Notifications
You must be signed in to change notification settings - Fork 0
homework number 15 #13
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Home work 15</title> | ||
</head> | ||
<body> | ||
|
||
<script src="src/main.js"></script> | ||
|
||
<header class="header"> | ||
<div class="container top-radius"> | ||
<h2>Contacts</h2> | ||
</div> | ||
</header> | ||
|
||
<main> | ||
<div class="container"> | ||
<form class="form-inline search-form"> | ||
<div class="form-group"> | ||
<label class="sr-only" for="search">Search</label> | ||
<input type="text" class="form-control" id= "search" placeholder="Search"> | ||
</div> | ||
</form> | ||
<table class="table table-hover contacts"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Last name</th> | ||
<th>Email</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Иван</td> | ||
<td>Петров</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Сергей</td> | ||
<td>Сергеев</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Иван</td> | ||
<td>Иванов</td> | ||
<td >[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Александр</td> | ||
<td>Александров</td> | ||
<td >[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Алекс</td> | ||
<td>Смирнов</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Сергей</td> | ||
<td>Волков</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Мария</td> | ||
<td>Шарапова</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Александр</td> | ||
<td>Винник</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Дарий</td> | ||
<td>Смирнов</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Елена</td> | ||
<td>Лещенко</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Ольга</td> | ||
<td>Новикова</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Наталья</td> | ||
<td>Шемякина</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Анна</td> | ||
<td>Донцова</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Влад</td> | ||
<td>Яма</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Кира</td> | ||
<td>Воробьева</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
<tr> | ||
<td>Виктор</td> | ||
<td>Кривенко</td> | ||
<td>[email protected]</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</main> | ||
<footer class="footer"> | ||
<div class="container bottom-radius"> | ||
<nav class="main-nav"> | ||
<a href="index.html" class="tab active"> | ||
<span class="glyphicon glyphicon-search" aria-hidden="true"></span> | ||
<span class = "tab-text">Contacts</span> | ||
</a> | ||
<a href="keypad.html" class="tab"> | ||
<span class="glyphicon glyphicon-th" aria-hidden="true"></span> | ||
<span class = "tab-text">Keypad</span> | ||
</a> | ||
<a href="edit-contact.html" class="tab"> | ||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> | ||
<span class = "tab-text">Edit contact</span> | ||
</a> | ||
<a href="user.html" class="tab"> | ||
<span class="glyphicon glyphicon-user" aria-hidden="true"></span> | ||
<span class = "tab-text">User</span> | ||
</a> | ||
<a href="add-user.html" class="tab"> | ||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> | ||
<span class = "tab-text">Add user</span> | ||
</a> | ||
</nav> | ||
</div> | ||
</footer> | ||
</body> | ||
</html> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<letters.length; i++){ | ||
const templ = new RegExp(letters.slice(i,i+1),'gmi'); | ||
if(!templ.test(str)){ | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; | ||
|
||
console.log('wyyga',solution("wyyga") ); | ||
console.log('qwertyuioplkjhgfdsazxcvbnm',solution("qwertyuioplkjhgfdsazxcvbnm") ); | ||
console.log('ejuxggfsts',solution("ejuxggfsts") ); | ||
console.log('qpwoeirutyalskdjfhgmznxbcv',solution("qpwoeirutyalskdjfhgmznxbcv") ); | ||
console.log('qqqqqqqqpwoeirutyallskkdjfhgmmznxbcv',solution("qqqqqqqqpwoeirutyallskkdjfhgmmznxbcv") ); | ||
console.log('0123456789abcdefghijklmnop',solution("0123456789abcdefghijklmnop") ); | ||
|
||
/* | ||
2. Напишите функция которая преобразовывает / открывает | ||
скобки всех вложенных внутри массивов | ||
Необходимо реализовать рекурсивный фызов функции. | ||
Функция должна открывать любое количество | ||
внутренних массивов и объектов | ||
example: | ||
[[1,2],[3,[4]],5, 10] => [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)){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are you using tabs in development? :) that task is a perfect candidate for reduce instead of forEach There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean saying "tabs"? And no, I can't do this task with reduce. |
||
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 | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use arrow function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done