compare(tree1 ,tree2 ){ let x =tree1.count() let y =tree2.count() if(x==y)return true; else return false; } //if you find this answer is useful , //upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)