diff --git a/avl.js b/avl.js index dc26499..b618142 100644 --- a/avl.js +++ b/avl.js @@ -1,19 +1,3 @@ -// TODO: Factor out to common module -Array.prototype.equals = function (other) { - if (this.length != other.length) { - return false; - } - - let i = this.length; - while (--i >= 0) { - if (this[i] !== other[i]) { - return false; - } - } - - return true; -}; - function balanceFactor(node) { if (!node) { return 0; diff --git a/index.html b/index.html index caa227f..0e83754 100755 --- a/index.html +++ b/index.html @@ -40,6 +40,8 @@ + + diff --git a/utils.js b/utils.js new file mode 100644 index 0000000..120f869 --- /dev/null +++ b/utils.js @@ -0,0 +1,14 @@ +Array.prototype.equals = function (other) { + if (this.length != other.length) { + return false; + } + + let i = this.length; + while (--i >= 0) { + if (this[i] !== other[i]) { + return false; + } + } + + return true; +};