-
Notifications
You must be signed in to change notification settings - Fork 0
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
домашнее 15 0-таск и визуализация таблицы #16
Open
olgakuzminagithub
wants to merge
2
commits into
master
Choose a base branch
from
homework_15
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Homework-16</title> | ||
</head> | ||
<body> | ||
|
||
|
||
<script src="src/main.js"></script> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
/* | ||
TASK 0 | ||
Проверьте что строка содержит все символы от "a" до "z" | ||
solution("wyyga") // false | ||
solution("qwertyuioplkjhgfdsazxcvbnm") // true | ||
solution("ejuxggfsts") // false | ||
solution("qpwoeirutyalskdjfhgmznxbcv") // true | ||
solution("qqqqqqqqpwoeirutyallskkdjfhgmmznxbcv") // true | ||
solution("0123456789abcdefghijklmnop") // false | ||
*/ | ||
|
||
/*Мне такое решение самой не нравиться, но лучше я не придумала((( */ | ||
|
||
const solution = str => { | ||
var newStr = str.replace(/a/, '$').replace(/b/, '$').replace(/c/, '$').replace(/d/, '$') | ||
.replace(/e/, '$').replace(/f/, '$').replace(/g/, '$').replace(/h/, '$') | ||
.replace(/i/, '$').replace(/j/, '$').replace(/k/, '$').replace(/l/, '$') | ||
.replace(/m/, '$').replace(/n/, '$').replace(/o/, '$').replace(/p/, '$') | ||
.replace(/q/, '$').replace(/r/, '$').replace(/s/, '$').replace(/t/, '$') | ||
.replace(/u/, '$').replace(/v/, '$').replace(/w/, '$').replace(/x/, '$') | ||
.replace(/y/, '$').replace(/z/, '$'); | ||
var newArr = newStr.split(''); | ||
var count = 0; | ||
newArr.forEach(elem => { | ||
if (elem === '$') { | ||
count ++; | ||
} | ||
}); | ||
if (count === 26) { | ||
console.log(true) | ||
} else { | ||
console.log(false) | ||
} | ||
|
||
}; | ||
|
||
solution("wyyga"); //false | ||
solution("qwertyuioplkjhgfdsazxcvbnm");//true | ||
solution("0123456789abcdefghijklmnop"); //false | ||
solution("qpwoeirutyalskdjfhgmznxbcv");// true | ||
solution("qqqqqqqqpwoeirutyallskkdjfhgmmznxbcv");// true | ||
solution("0123456789abcdefghijklmnop");// false | ||
|
||
/* | ||
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 => { | ||
|
||
}; | ||
|
||
|
||
/* Рекурсия не получиласьБ решение со сплайсами у меня в 5 хомверке*/ | ||
|
||
|
||
/* | ||
Виртуализировать таблицу, сделать рендер всей | ||
таблицы через JavaScript. | ||
Второй макет. | ||
https://github.com/aleksandra-maslennikova/telephone-book/blob/master/index.html | ||
Выглядеть должно так же: https://aleksandra-maslennikova.github.io/telephone-book/index.html | ||
*/ | ||
|
||
const users = [ | ||
{ | ||
name: 'Иван', | ||
lastName: 'Петров', | ||
email: 'ivanpetrov@gmail.com' | ||
}, | ||
{ | ||
name: 'Сергей', | ||
lastName:'Сергеев', | ||
email: 'sergeysergeev@gmail.com' | ||
}, | ||
{ | ||
name: 'Иван', | ||
lastName: 'Петров', | ||
email: 'ivanpetrov@gmail.com' | ||
}, | ||
{ | ||
name: 'Александр', | ||
lastName: 'Александров', | ||
email: 'alex@gmail.com' | ||
}, | ||
{ | ||
name: 'Алекс', | ||
lastName: 'Смирнов', | ||
email: 'smirnov@gmail.com' | ||
}, | ||
]; | ||
const colums = ['Name', 'LastName', 'Email']; | ||
const app = { | ||
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. please make class instead of object |
||
users, | ||
colums, | ||
newEl(elName) { | ||
return document.createElement(elName); | ||
}, | ||
render() { | ||
const main = this.newEl('main'); | ||
const table = this.newEl('table'); | ||
const tr = this.newEl('tr'); | ||
colums.forEach( columName => { | ||
const th = this.newEl('th'); | ||
th.textContent = columName; | ||
tr.appendChild(th); | ||
|
||
}); | ||
table.appendChild(tr); | ||
users.forEach(user => { | ||
const tr = this.newEl('tr'); | ||
const td1 = this.newEl('td'); | ||
td1.textContent = user.name; | ||
const td2 = this.newEl('td'); | ||
td2.textContent = user.lastName; | ||
const td3 = this.newEl('td'); | ||
td3.textContent = user.lastName; | ||
tr.appendChild(td1); | ||
tr.appendChild(td2); | ||
tr.appendChild(td3); | ||
table.appendChild(tr); | ||
}); | ||
main.appendChild(table); | ||
document.body.appendChild(main); | ||
} | ||
}; | ||
|
||
app.render(); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
wow :)