-
Notifications
You must be signed in to change notification settings - Fork 37
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
single and doubly lists #24
base: master
Are you sure you want to change the base?
Conversation
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.
LGTM except minor syntax issues. Also we don't use spaces in empty lines and trailing spaces at all.
|
||
append(value) { | ||
if (!list.head) { | ||
list.head = Node(value) |
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.
semicolon
|
||
append(value) { | ||
if (!list.head) { | ||
list.head = Node(value) |
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.
semicolon
@@ -0,0 +1,64 @@ | |||
|
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.
'use strict';
@@ -0,0 +1,64 @@ | |||
|
|||
const Node = (value, next = null) => ({ |
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.
It is not a class or prototype constructor so I'd like to use lowerCamelCase here.
list.append(4); | ||
list.remove(3); | ||
|
||
for (item of list) { |
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.
for (const item of list) {
|
||
// Usage | ||
|
||
const list = LinkedList(); |
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.
lowerCamelCase
next, | ||
}); | ||
|
||
const LinkedList = () => { |
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.
lowerCamelCase
@@ -0,0 +1,66 @@ | |||
|
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.
'use strict';
} | ||
}, | ||
|
||
[Symbol.iterator]: function* () { |
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.
Use shorter syntax for generator as a class/object method:
{
*[Symbol.iterator]() {
// code here
}
}
} | ||
}, | ||
|
||
[Symbol.iterator]: function* () { |
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.
Use shorter syntax for generators.
No description provided.