xxxxxxxxxx
contains(value) {
if (!this.root.value) {
return false;
};
let searchValue = (current, value) => {
if (current.value === value) {
return true;
} else if (current.value > value) {
if (!current.left) {
return false;
}
return searchValue(current.left, value);
} else {
if (!current.right) {
return false;
}
return searchValue(current.right, value);
};
};
return searchValue(this.root, value);
};
};
//if you find the answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)