Skip to content
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

Homework 14 #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Homework 14 #12

wants to merge 3 commits into from

Conversation

maxeasy18
Copy link
Collaborator

No comments.

<script src="src/main.js"></script>


<!-- <div class="test-block">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not commit commented code it makes it hard to understand if it a mistake or commented solution or what do you really mean.

Your homework should be clear without commented code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted


function solution(arr){
let _temp = {}
arr.forEach( function(element, index) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a nice place to use Array.prototype.reduce

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


let res = [];

Object.keys(_temp).forEach(function(value){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your solution looks similar to Sergey are you worked a pair-programming?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope....

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is solution wrong& what I must to do with your comment?

div.appendChild(head);

let form = document.createElement('form');

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove blank line here.
In most scenarios or code-bases there few blank lines if some more complex logic begin or you divide declaring variables and app logic

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've deleted blank rows

*/
let app = {
render(){
let div = document.createElement('div');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have very huge "render" method which doing a lot of job.

That has roles:

  • "the-storage - where you stored all you data"
  • initializing elements
  • creating elements
  • connect elements
  • some knowledge of content

It will be much better to make a smaller function which would have only 1 responsibility, and than connect such parts inside render

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made smaller render function.
Data and functions are splitted.

@maxeasy18
Copy link
Collaborator Author

Changes was pushed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants