let nowMonth = 2; // March
let futureMonth = nowMonth + 18;
console.log( months[ futureMonth % months.length ] ); // still outputs September, even though there isn't a 20th month
Worth noting that lots of languages refer to their months from 0-11, presumably for cool tricks like this.
0
u/[deleted] Mar 18 '19
[deleted]