Skip to content

Conversation

@AnnaYasenova
Copy link

Implemented next methods: visitDepth, isHave, addData.

Copy link
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.

Много где можно заменить let на const. Проведи через eslint


(function recursive(currNode) {

let len = currNode.child.length,
Copy link
Member

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;

(function recursive(currNode) {

let len = currNode.child.length,
num;
Copy link
Member

Choose a reason for hiding this comment

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

let num;


Tree.prototype.addData = function(name, data, whereAdd) {
let parent = null,
callback = function(n) {
Copy link
Member

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) {
Copy link
Member

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) ?

Copy link
Author

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) {
Copy link
Member

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?

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