Skip to content

Week-2 Updated code - To be reviewed#2

Open
amanrajs wants to merge 4 commits intomasterfrom
week-2
Open

Week-2 Updated code - To be reviewed#2
amanrajs wants to merge 4 commits intomasterfrom
week-2

Conversation

@amanrajs
Copy link
Owner

No description provided.

padding:10px;
}
.closeButton{
}
Copy link

Choose a reason for hiding this comment

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

we can remove this

let data=[];
for(item in article_data){
if(data.indexOf(article_data[item].postCategory)!==-1){
continue;
Copy link

Choose a reason for hiding this comment

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

generally if else block is indented as below example

if(condition) {
  //code
} else if(condition) {
  //code
} else {
  //code
}

fullContainer.appendChild(right_container);
select.options[0].disabled = true;
select.onchange = () => {
let val=select.value;
Copy link

Choose a reason for hiding this comment

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

can get rid of this line and use the expression in below line.

let val=select.value;
changeContent(val,container);
}
}
Copy link

Choose a reason for hiding this comment

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

consider splitting this function to few smaller functions

@@ -0,0 +1,89 @@
const defaultContent='Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
const defaultDescription='created at 21 July 2019""created at 21 July 2019';
Copy link

Choose a reason for hiding this comment

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

can use single const declaration for all variables.

card.appendChild(right);
container.appendChild(card);
container.appendChild(horizontalline);
fullContainer.appendChild(container);
Copy link

Choose a reason for hiding this comment

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

consider splitting this function into few smaller functions

if(regexEmail.test(emailid)){
window.localStorage.setItem(emailid, JSON.stringify(emailid));
alert(emailSubscribedMessage);
}
Copy link

Choose a reason for hiding this comment

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

generally if else block is indented as below example

if(condition) {
  //code
} else if(condition) {
  //code
} else {
  //code
}

popup.appendChild(descriptionPopup);
fullContainer.style.opacity = '0.3';
}
else if(clickEvent.srcElement.id === 'closePopup'){
Copy link

Choose a reason for hiding this comment

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

generally if else block is indented as below example

if(condition) {
  //code
} else if(condition) {
  //code
} else {
  //code
}

right_container.appendChild(titleSelectCategory);
right_container.appendChild(select);
right_container.appendChild(subscribeTitle);
right_container.appendChild(check);
Copy link

Choose a reason for hiding this comment

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

few places same dom manipulation function used, this can be clubbed by making a few common functions. this can reduce a lot of code lines.
discuss with me if you are not clear what i am telling

29amansingh and others added 2 commits July 29, 2019 17:26
-> using a common createCard function for both static and news data,to reduce dom code in a single function
->other minor changes
@mnhaque
Copy link

mnhaque commented Jul 29, 2019

looks good

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