JSFiddle - React, Tailwind, and code Playground
JavaScript
const reverse = (arr) => {
const result = [];
arr.forEach((item) => {
result.unshift(item);
});
return result;
};
console.log(reverse(['john', 'smith', 'karl']));
const reverse = (arr) => {
const result = [];
arr.forEach((item) => {
result.unshift(item);
});
return result;
};
console.log(reverse(['john', 'smith', 'karl']));