-
Notifications
You must be signed in to change notification settings - Fork 13
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
Additional functions. #10
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.
Много где можно заменить let на const. Проведи через eslint
JavaScript/4-newfunc.js
Outdated
|
||
(function recursive(currNode) { | ||
|
||
let len = currNode.child.length, |
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.
const len = currNode.child.length;
JavaScript/4-newfunc.js
Outdated
(function recursive(currNode) { | ||
|
||
let len = currNode.child.length, | ||
num; |
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.
let num;
JavaScript/4-newfunc.js
Outdated
|
||
Tree.prototype.addData = function(name, data, whereAdd) { | ||
let parent = null, | ||
callback = function(n) { |
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.
Лучше отдельно объявлять
|
||
Tree.prototype.visitDepth = function(callback) { | ||
|
||
(function recursive(currNode) { |
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.
What is a purpose of this IIFE (immediately-invoked function expression) ?
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.
На парі показали такий варіант реалізації - вирішила спробувати, не більше того.
})(this.root); | ||
}; | ||
|
||
Tree.prototype.isHave = function(callback) { |
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.
Tree.has(node)
returns boolean, no need callback but where is node argument to check?
Implemented next methods: visitDepth, isHave, addData.