Many of JavaScript's Array methods return an altered version of the array while leaving the source array intact. Array.reverse() is not one of those. Instead, it alters the source array in addition to returning the altered version, which is likely not what was intended.

Noncompliant Code Example

var b = a.reverse(); // Noncompliant

Compliant Solution

var b = [...a].reverse();  // de-structure and create a new array, so reverse doesn't impact 'a'

a.reverse();