$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · easy · #100

Fill in the blank

// returns the array reversed without mutating
function reversed(arr: number[]): number[] {
  return [...arr].____();
}
// reversed([1,2,3]) -> [3,2,1]

Answer: reverse (also accepted: reverse, reverse())

reverse() flips the order of elements in the array.
Play Problem Solving ▸