diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index 9c856c4edf..2c7c8a1dc8 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -214,8 +214,7 @@ class ScrollSpy { return } - const offsetLength = this._offsets.length - for (let i = offsetLength; i--;) { + for (let i = this._offsets.length; i--;) { const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' ||