Skip to content

Instantly share code, notes, and snippets.

@michaelward82
Created March 31, 2014 13:11
Show Gist options
  • Select an option

  • Save michaelward82/9891934 to your computer and use it in GitHub Desktop.

Select an option

Save michaelward82/9891934 to your computer and use it in GitHub Desktop.

Revisions

  1. Michael Ward created this gist Mar 31, 2014.
    7 changes: 7 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    /**
    * @param int currentIndex
    **/
    Array.prototype.nextIndex = function (currentIndex) {
    // currentIndex + 1 if in bounds, else 0
    return currentIndex < this.length - 1 ? currentIndex + 1 : 0;
    }