JSFiddle - React, Tailwind, and code Playground

by Vladymyr Shevchuk

JavaScript

const reverse = (arr) => {
  const result = [];

  arr.forEach((item) => {
    result.unshift(item);
  });

  return result;
};

console.log(reverse(['john', 'smith', 'karl']));