how reverse() work in javascript code example Example: reverse array javascript var rev = arr.reverse();