Skip to content

TaskList. Anastasiya Santalova #2

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

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

TaskList. Anastasiya Santalova #2

wants to merge 8 commits into from

Conversation

AnastasiyaSantalova
Copy link

No description provided.

var taskList;
var localTaskList = JSON.parse(localStorage.getItem('myArr'));

if (localTaskList.length == 0) {
Copy link

Choose a reason for hiding this comment

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

It would fail while getting length if I don't have such item in local storage.

Also, use triple equals operator

Choose a reason for hiding this comment

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

Fixed!

break;
case 'today':
taskList.forEach(function (curr) {
console.log(compareDates(curr.deadline));
Copy link

Choose a reason for hiding this comment

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

It could be removed I suppose

// * CHANGESTAT: change and save task status (completed / not completed)


var list = (function (){
Copy link

Choose a reason for hiding this comment

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

Please add whitespace before curly brace

In future I'd recommend to use linters e.g. ESLint which have warning messages if you violate the styleguide and also some tools like Prettier which could fix those problems

}

return {
create: function (text,deadline) {
Copy link

Choose a reason for hiding this comment

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

Separate function args with whitespace

var ind;

taskList.forEach(function (curr, i) {
if (curr.id == id) {
Copy link

Choose a reason for hiding this comment

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

Use triple equals operator


border-bottom: 1px dashed lightgray;

//@include borderGray(dashed);
Copy link

Choose a reason for hiding this comment

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

Remove commented line please

delete: function (id) {
var ind;

taskList.forEach(function (curr, i) {
Copy link

Choose a reason for hiding this comment

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

Instead of forEach + splice combination I'd use filter

div.appendChild(delSpan);
delSpan.appendChild(delButton);

delButtonOnclick();
Copy link

Choose a reason for hiding this comment

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

Use camelCase please: delButtonOnClick. The same note for the function below

},

changestat: function(id) {
taskList.forEach(function (curr) {
Copy link

Choose a reason for hiding this comment

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

I'd use find since it will stop after finding needed element

Choose a reason for hiding this comment

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

As far as I know find can be used only in ES6

Copy link

Choose a reason for hiding this comment

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

Yes, you're right, my bad :)

list.push(newTask);
list.show();
}
};;
Copy link

Choose a reason for hiding this comment

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

Excessive semicolon

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.

2 participants