Skip to content
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

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

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