Skip to content

single and doubly lists#24

Open
agil wants to merge 1 commit intomasterfrom
single-doubly-linked-lists
Open

single and doubly lists#24
agil wants to merge 1 commit intomasterfrom
single-doubly-linked-lists

Conversation

@agil
Copy link
Copy Markdown
Member

@agil agil commented Jul 9, 2018

No description provided.

@agil agil requested a review from tshemsedinov July 9, 2018 18:52
Copy link
Copy Markdown
Member

@tshemsedinov tshemsedinov left a comment

Choose a reason for hiding this comment

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

LGTM except minor syntax issues. Also we don't use spaces in empty lines and trailing spaces at all.

Comment thread JavaScript/7-single.js

append(value) {
if (!list.head) {
list.head = Node(value)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

semicolon

Comment thread JavaScript/8-doubly.js

append(value) {
if (!list.head) {
list.head = Node(value)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

semicolon

Comment thread JavaScript/7-single.js
@@ -0,0 +1,64 @@

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

'use strict';

Comment thread JavaScript/7-single.js
@@ -0,0 +1,64 @@

const Node = (value, next = null) => ({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It is not a class or prototype constructor so I'd like to use lowerCamelCase here.

Comment thread JavaScript/8-doubly.js
list.append(4);
list.remove(3);

for (item of list) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

for (const item of list) {

Comment thread JavaScript/7-single.js

// Usage

const list = LinkedList();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lowerCamelCase

Comment thread JavaScript/7-single.js
next,
});

const LinkedList = () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lowerCamelCase

Comment thread JavaScript/8-doubly.js
@@ -0,0 +1,66 @@

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

'use strict';

Comment thread JavaScript/7-single.js
}
},

[Symbol.iterator]: function* () {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use shorter syntax for generator as a class/object method:

{
  *[Symbol.iterator]() {
    // code here
  }
}

Comment thread JavaScript/8-doubly.js
}
},

[Symbol.iterator]: function* () {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use shorter syntax for generators.

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