negate the array in java javascript code example Example: reverse array javascript const list = [1, 2, 3, 4, 5]; list.reverse();